-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathModemUpdateDialogView-test.ts
More file actions
103 lines (90 loc) · 3.43 KB
/
ModemUpdateDialogView-test.ts
File metadata and controls
103 lines (90 loc) · 3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
* Copyright (c) 2026 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
*/
import {
isValidNrf91x1FirmwareName,
isValidNrf9160FirmwareName,
} from '../ModemUpdateDialogView';
describe('Modem firmware filename validation', () => {
describe('nRF9160 firmware names', () => {
it('accepts names from https://www.nordicsemi.com/Products/nRF9160/Download', () => {
expect(isValidNrf9160FirmwareName('mfw_nrf9160_1.1.0.zip')).toBe(
true,
);
expect(isValidNrf9160FirmwareName('mfw_nrf9160_1.3.7.zip')).toBe(
true,
);
});
it('accepts undefined as valid (no file selected)', () => {
expect(isValidNrf9160FirmwareName(undefined)).toBe(true);
});
describe('invalid names', () => {
it('rejects wrong prefix', () => {
expect(isValidNrf9160FirmwareName('fw_nrf9160_1.0.0.zip')).toBe(
false,
);
});
it('rejects non-zip file', () => {
expect(
isValidNrf9160FirmwareName('mfw_nrf9160_1.1.0.tar'),
).toBe(false);
});
it('rejects nRF91x1 firmware names', () => {
expect(
isValidNrf9160FirmwareName('mfw_nrf91x1_2.0.4.zip'),
).toBe(false);
expect(
isValidNrf9160FirmwareName('mfw-pti_nrf91x1_2.3.8.zip'),
).toBe(false);
});
});
});
describe('nRF91x1 firmware names', () => {
it('accepts names from https://www.nordicsemi.com/Products/nRF9161/Download', () => {
expect(isValidNrf91x1FirmwareName('mfw_nrf91x1_2.0.0.zip')).toBe(
true,
);
expect(isValidNrf91x1FirmwareName('mfw_nrf91x1_2.0.4.zip')).toBe(
true,
);
expect(
isValidNrf91x1FirmwareName('mfw-pti_nrf91x1_2.3.1.zip'),
).toBe(true);
expect(
isValidNrf91x1FirmwareName('mfw-pti_nrf91x1_2.3.8.zip'),
).toBe(true);
});
it('DECT names from https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/getting-started-with-nr-phy', () => {
expect(
isValidNrf91x1FirmwareName('mfw-nr+_nrf91x1_1.0.0.zip'),
).toBe(true);
});
it('accepts names from https://www.nordicsemi.com/Products/nRF9151/Download', () => {
expect(
isValidNrf91x1FirmwareName('mfw_nrf9151-ntn_1.0.0-1.alpha.zip'),
).toBe(true);
});
it('accepts undefined as valid (no file selected)', () => {
expect(isValidNrf91x1FirmwareName(undefined)).toBe(true);
});
describe('invalid names', () => {
it('rejects wrong prefix', () => {
expect(isValidNrf91x1FirmwareName('fw_nrf91x1_2.0.0.zip')).toBe(
false,
);
});
it('rejects non-zip file', () => {
expect(
isValidNrf91x1FirmwareName('mfw_nrf91x1_2.0.0.tar'),
).toBe(false);
});
it('rejects nRF9160 firmware names', () => {
expect(
isValidNrf91x1FirmwareName('mfw_nrf9160_1.1.0.zip'),
).toBe(false);
});
});
});
});