@ledgerhq/device-core 0.9.0 → 0.9.1-nightly.20260317030141
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +12 -0
- package/lib/commands/use-cases/isCharonSupported.d.ts +1 -1
- package/lib/commands/use-cases/isCharonSupported.d.ts.map +1 -1
- package/lib-es/commands/use-cases/isCharonSupported.d.ts +1 -1
- package/lib-es/commands/use-cases/isCharonSupported.d.ts.map +1 -1
- package/lib-es/errors.d.ts +14 -14
- package/package.json +29 -12
- package/src/commands/use-cases/isCharonSupported.ts +1 -1
- package/src/managerApi/repositories/HttpManagerApiRepository.test.ts +34 -45
- package/tsconfig.build.json +18 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
2
|
> @ledgerhq/device-core@0.9.0 build /home/runner/work/ledger-live/ledger-live/libs/device-core
|
|
3
|
-
> tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es
|
|
3
|
+
> tsc --project tsconfig.build.json && tsc --project tsconfig.build.json -m esnext --moduleResolution bundler --outDir lib-es
|
|
4
4
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ledgerhq/device-core
|
|
2
2
|
|
|
3
|
+
## 0.9.1-nightly.20260317030141
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`c8d7be6`](https://github.com/LedgerHQ/ledger-live/commit/c8d7be6964aa9d8defd77de0b77ba7d42f472025), [`a270b43`](https://github.com/LedgerHQ/ledger-live/commit/a270b438bf8aca99b795679fecce1b55dc249c12), [`ffb3c46`](https://github.com/LedgerHQ/ledger-live/commit/ffb3c46acd292b9ac0f46a2b84509d02775a5f20), [`7cbfb7d`](https://github.com/LedgerHQ/ledger-live/commit/7cbfb7dd2d52ad8380ab4d37b02f63292699cd68), [`bfa4315`](https://github.com/LedgerHQ/ledger-live/commit/bfa4315d2f3b4b95c5a742ffd6e05272662f4550), [`75dfb86`](https://github.com/LedgerHQ/ledger-live/commit/75dfb86c871a026aa90136d0184637878d484484), [`e6f26e0`](https://github.com/LedgerHQ/ledger-live/commit/e6f26e0f475763aaf3271e2d4ed6cf36fb1f5060), [`9f559e9`](https://github.com/LedgerHQ/ledger-live/commit/9f559e98a1af37073e0e79ee5bb54b4aaecfb8c4), [`70f6288`](https://github.com/LedgerHQ/ledger-live/commit/70f6288597722a1e8fd6b5884d843f27be87e9d8), [`ad66568`](https://github.com/LedgerHQ/ledger-live/commit/ad66568fd9c96cfa08d11123a711e3fa79705f65), [`4cc02f3`](https://github.com/LedgerHQ/ledger-live/commit/4cc02f3c1ba0bdb93917b5427a375ab44cd5d208), [`37bc15e`](https://github.com/LedgerHQ/ledger-live/commit/37bc15e245107ce1044f36b57d191552a77329e6)]:
|
|
8
|
+
- @ledgerhq/devices@8.12.0-nightly.20260317030141
|
|
9
|
+
- @ledgerhq/errors@6.31.0-nightly.20260317030141
|
|
10
|
+
- @ledgerhq/hw-transport@6.34.0-nightly.20260317030141
|
|
11
|
+
- @ledgerhq/logs@6.16.0-nightly.20260317030141
|
|
12
|
+
- @ledgerhq/types-live@6.101.0-nightly.20260317030141
|
|
13
|
+
- @ledgerhq/live-network@2.4.1-nightly.20260317030141
|
|
14
|
+
|
|
3
15
|
## 0.9.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isCharonSupported.d.ts","sourceRoot":"","sources":["../../../src/commands/use-cases/isCharonSupported.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"isCharonSupported.d.ts","sourceRoot":"","sources":["../../../src/commands/use-cases/isCharonSupported.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AASxD,eAAO,MAAM,iBAAiB,GAAI,WAAW,MAAM,EAAE,UAAU,aAAa,KAAG,OAS9E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isCharonSupported.d.ts","sourceRoot":"","sources":["../../../src/commands/use-cases/isCharonSupported.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"isCharonSupported.d.ts","sourceRoot":"","sources":["../../../src/commands/use-cases/isCharonSupported.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AASxD,eAAO,MAAM,iBAAiB,GAAI,WAAW,MAAM,EAAE,UAAU,aAAa,KAAG,OAS9E,CAAC"}
|
package/lib-es/errors.d.ts
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
export declare const AppNotFound: import("@ledgerhq/errors/lib/helpers").LedgerErrorConstructor<{
|
|
1
|
+
export declare const AppNotFound: import("@ledgerhq/errors/lib-es/helpers").LedgerErrorConstructor<{
|
|
2
2
|
[key: string]: unknown;
|
|
3
3
|
}>;
|
|
4
|
-
export declare const InvalidContext: import("@ledgerhq/errors/lib/helpers").LedgerErrorConstructor<{
|
|
4
|
+
export declare const InvalidContext: import("@ledgerhq/errors/lib-es/helpers").LedgerErrorConstructor<{
|
|
5
5
|
[key: string]: unknown;
|
|
6
6
|
}>;
|
|
7
|
-
export declare const InvalidAppNameLength: import("@ledgerhq/errors/lib/helpers").LedgerErrorConstructor<{
|
|
7
|
+
export declare const InvalidAppNameLength: import("@ledgerhq/errors/lib-es/helpers").LedgerErrorConstructor<{
|
|
8
8
|
[key: string]: unknown;
|
|
9
9
|
}>;
|
|
10
|
-
export declare const GenerateAesKeyFailed: import("@ledgerhq/errors/lib/helpers").LedgerErrorConstructor<{
|
|
10
|
+
export declare const GenerateAesKeyFailed: import("@ledgerhq/errors/lib-es/helpers").LedgerErrorConstructor<{
|
|
11
11
|
[key: string]: unknown;
|
|
12
12
|
}>;
|
|
13
|
-
export declare const InternalCryptoOperationFailed: import("@ledgerhq/errors/lib/helpers").LedgerErrorConstructor<{
|
|
13
|
+
export declare const InternalCryptoOperationFailed: import("@ledgerhq/errors/lib-es/helpers").LedgerErrorConstructor<{
|
|
14
14
|
[key: string]: unknown;
|
|
15
15
|
}>;
|
|
16
|
-
export declare const InternalComputeAesCmacFailed: import("@ledgerhq/errors/lib/helpers").LedgerErrorConstructor<{
|
|
16
|
+
export declare const InternalComputeAesCmacFailed: import("@ledgerhq/errors/lib-es/helpers").LedgerErrorConstructor<{
|
|
17
17
|
[key: string]: unknown;
|
|
18
18
|
}>;
|
|
19
|
-
export declare const EncryptAppStorageFailed: import("@ledgerhq/errors/lib/helpers").LedgerErrorConstructor<{
|
|
19
|
+
export declare const EncryptAppStorageFailed: import("@ledgerhq/errors/lib-es/helpers").LedgerErrorConstructor<{
|
|
20
20
|
[key: string]: unknown;
|
|
21
21
|
}>;
|
|
22
|
-
export declare const PinNotSet: import("@ledgerhq/errors/lib/helpers").LedgerErrorConstructor<{
|
|
22
|
+
export declare const PinNotSet: import("@ledgerhq/errors/lib-es/helpers").LedgerErrorConstructor<{
|
|
23
23
|
[key: string]: unknown;
|
|
24
24
|
}>;
|
|
25
|
-
export declare const InvalidBackupHeader: import("@ledgerhq/errors/lib/helpers").LedgerErrorConstructor<{
|
|
25
|
+
export declare const InvalidBackupHeader: import("@ledgerhq/errors/lib-es/helpers").LedgerErrorConstructor<{
|
|
26
26
|
[key: string]: unknown;
|
|
27
27
|
}>;
|
|
28
|
-
export declare const InvalidBackupLength: import("@ledgerhq/errors/lib/helpers").LedgerErrorConstructor<{
|
|
28
|
+
export declare const InvalidBackupLength: import("@ledgerhq/errors/lib-es/helpers").LedgerErrorConstructor<{
|
|
29
29
|
[key: string]: unknown;
|
|
30
30
|
}>;
|
|
31
|
-
export declare const InvalidBackupState: import("@ledgerhq/errors/lib/helpers").LedgerErrorConstructor<{
|
|
31
|
+
export declare const InvalidBackupState: import("@ledgerhq/errors/lib-es/helpers").LedgerErrorConstructor<{
|
|
32
32
|
[key: string]: unknown;
|
|
33
33
|
}>;
|
|
34
|
-
export declare const InvalidRestoreState: import("@ledgerhq/errors/lib/helpers").LedgerErrorConstructor<{
|
|
34
|
+
export declare const InvalidRestoreState: import("@ledgerhq/errors/lib-es/helpers").LedgerErrorConstructor<{
|
|
35
35
|
[key: string]: unknown;
|
|
36
36
|
}>;
|
|
37
|
-
export declare const InvalidChunkLength: import("@ledgerhq/errors/lib/helpers").LedgerErrorConstructor<{
|
|
37
|
+
export declare const InvalidChunkLength: import("@ledgerhq/errors/lib-es/helpers").LedgerErrorConstructor<{
|
|
38
38
|
[key: string]: unknown;
|
|
39
39
|
}>;
|
|
40
|
-
export declare const UserRefusedOnDevice: import("@ledgerhq/errors/lib/helpers").LedgerErrorConstructor<{
|
|
40
|
+
export declare const UserRefusedOnDevice: import("@ledgerhq/errors/lib-es/helpers").LedgerErrorConstructor<{
|
|
41
41
|
[key: string]: unknown;
|
|
42
42
|
}>;
|
|
43
43
|
//# sourceMappingURL=errors.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/device-core",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1-nightly.20260317030141",
|
|
4
4
|
"description": "Ledger Live device core module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -20,18 +20,18 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@noble/hashes": "1.8.0",
|
|
22
22
|
"semver": "7.7.3",
|
|
23
|
-
"@ledgerhq/devices": "8.
|
|
24
|
-
"@ledgerhq/errors": "^6.
|
|
25
|
-
"@ledgerhq/hw-transport": "6.
|
|
26
|
-
"@ledgerhq/live-network": "^2.4.
|
|
27
|
-
"@ledgerhq/logs": "^6.
|
|
28
|
-
"@ledgerhq/types-live": "^6.
|
|
23
|
+
"@ledgerhq/devices": "8.12.0-nightly.20260317030141",
|
|
24
|
+
"@ledgerhq/errors": "^6.31.0-nightly.20260317030141",
|
|
25
|
+
"@ledgerhq/hw-transport": "6.34.0-nightly.20260317030141",
|
|
26
|
+
"@ledgerhq/live-network": "^2.4.1-nightly.20260317030141",
|
|
27
|
+
"@ledgerhq/logs": "^6.16.0-nightly.20260317030141",
|
|
28
|
+
"@ledgerhq/types-live": "^6.101.0-nightly.20260317030141"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@testing-library/dom": "10.4.1",
|
|
32
32
|
"@testing-library/react": "16.3.1",
|
|
33
33
|
"@types/jest": "30.0.0",
|
|
34
|
-
"@types/node": "
|
|
34
|
+
"@types/node": "24.12.0",
|
|
35
35
|
"@types/semver": "7.7.1",
|
|
36
36
|
"@types/sha.js": "^2.4.4",
|
|
37
37
|
"jest": "30.2.0",
|
|
@@ -55,15 +55,32 @@
|
|
|
55
55
|
]
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
|
+
"exports": {
|
|
59
|
+
".": {
|
|
60
|
+
"@ledgerhq/source": "./src/index.ts",
|
|
61
|
+
"import": "./lib-es/index.js",
|
|
62
|
+
"require": "./lib/index.js",
|
|
63
|
+
"default": "./lib/index.js"
|
|
64
|
+
},
|
|
65
|
+
"./lib-es/*": "./lib-es/*.js",
|
|
66
|
+
"./lib/*": "./lib/*.js",
|
|
67
|
+
"./*": {
|
|
68
|
+
"@ledgerhq/source": "./src/*.ts",
|
|
69
|
+
"import": "./lib-es/*.js",
|
|
70
|
+
"require": "./lib/*.js",
|
|
71
|
+
"default": "./lib/*.js"
|
|
72
|
+
},
|
|
73
|
+
"./package.json": "./package.json"
|
|
74
|
+
},
|
|
58
75
|
"scripts": {
|
|
59
76
|
"clean": "rimraf lib lib-es",
|
|
60
|
-
"build": "tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es",
|
|
77
|
+
"build": "tsc --project tsconfig.build.json && tsc --project tsconfig.build.json -m esnext --moduleResolution bundler --outDir lib-es",
|
|
61
78
|
"prewatch": "pnpm build",
|
|
62
|
-
"watch": "tsc --watch",
|
|
63
|
-
"watch:es": "tsc --watch -m esnext --moduleResolution bundler --outDir lib-es",
|
|
79
|
+
"watch": "tsc --watch --project tsconfig.build.json",
|
|
80
|
+
"watch:es": "tsc --watch --project tsconfig.build.json -m esnext --moduleResolution bundler --outDir lib-es",
|
|
64
81
|
"lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx --cache",
|
|
65
82
|
"lint:fix": "pnpm lint --fix",
|
|
66
|
-
"typecheck": "tsc --noEmit",
|
|
83
|
+
"typecheck": "tsc --noEmit --customConditions node",
|
|
67
84
|
"unimported": "unimported",
|
|
68
85
|
"test": "jest",
|
|
69
86
|
"coverage": "jest --coverage"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DeviceModelId } from "@ledgerhq/devices/
|
|
1
|
+
import { DeviceModelId } from "@ledgerhq/devices/index";
|
|
2
2
|
import { satisfies as versionSatisfies, coerce as semverCoerce } from "semver";
|
|
3
3
|
|
|
4
4
|
const deviceVersionRangesForCharon: { [key in DeviceModelId]?: string } = {
|
|
@@ -23,6 +23,14 @@ import network from "@ledgerhq/live-network/network";
|
|
|
23
23
|
|
|
24
24
|
const mockedGetUserHashes = jest.mocked(getUserHashes);
|
|
25
25
|
const mockedNetwork = jest.mocked(network);
|
|
26
|
+
const createAxiosResponse = <T>(data: T): Awaited<ReturnType<typeof network>> =>
|
|
27
|
+
({
|
|
28
|
+
data,
|
|
29
|
+
status: 200,
|
|
30
|
+
statusText: "OK",
|
|
31
|
+
headers: {},
|
|
32
|
+
config: {},
|
|
33
|
+
}) as Awaited<ReturnType<typeof network>>;
|
|
26
34
|
|
|
27
35
|
describe("HttpManagerApiRepository", () => {
|
|
28
36
|
let httpManagerApiRepository: HttpManagerApiRepository;
|
|
@@ -40,6 +48,7 @@ describe("HttpManagerApiRepository", () => {
|
|
|
40
48
|
test("fetchLatestFirmware should call network() with the correct parameters", async () => {
|
|
41
49
|
mockedGetUserHashes.mockReturnValue({
|
|
42
50
|
firmwareSalt: "mockedFirmwareSalt",
|
|
51
|
+
endpointOverrides100: 0,
|
|
43
52
|
});
|
|
44
53
|
const params: Parameters<typeof httpManagerApiRepository.fetchLatestFirmware>[0] = {
|
|
45
54
|
current_se_firmware_final_version: 888,
|
|
@@ -67,6 +76,7 @@ describe("HttpManagerApiRepository", () => {
|
|
|
67
76
|
test("fetchLatestFirmware should return null if data.result is null", async () => {
|
|
68
77
|
mockedGetUserHashes.mockReturnValue({
|
|
69
78
|
firmwareSalt: "mockedFirmwareSalt",
|
|
79
|
+
endpointOverrides100: 0,
|
|
70
80
|
});
|
|
71
81
|
const params: Parameters<typeof httpManagerApiRepository.fetchLatestFirmware>[0] = {
|
|
72
82
|
current_se_firmware_final_version: 888,
|
|
@@ -74,11 +84,11 @@ describe("HttpManagerApiRepository", () => {
|
|
|
74
84
|
providerId: 12,
|
|
75
85
|
userId: "userId",
|
|
76
86
|
};
|
|
77
|
-
mockedNetwork.mockResolvedValue(
|
|
78
|
-
|
|
87
|
+
mockedNetwork.mockResolvedValue(
|
|
88
|
+
createAxiosResponse({
|
|
79
89
|
result: "null",
|
|
80
|
-
},
|
|
81
|
-
|
|
90
|
+
}),
|
|
91
|
+
);
|
|
82
92
|
|
|
83
93
|
const result = await httpManagerApiRepository.fetchLatestFirmware(params);
|
|
84
94
|
|
|
@@ -88,6 +98,7 @@ describe("HttpManagerApiRepository", () => {
|
|
|
88
98
|
test("fetchLatestFirmware should return data.se_firmware_osu_version", async () => {
|
|
89
99
|
mockedGetUserHashes.mockReturnValue({
|
|
90
100
|
firmwareSalt: "mockedFirmwareSalt",
|
|
101
|
+
endpointOverrides100: 0,
|
|
91
102
|
});
|
|
92
103
|
const params: Parameters<typeof httpManagerApiRepository.fetchLatestFirmware>[0] = {
|
|
93
104
|
current_se_firmware_final_version: 888,
|
|
@@ -95,12 +106,12 @@ describe("HttpManagerApiRepository", () => {
|
|
|
95
106
|
providerId: 12,
|
|
96
107
|
userId: "userId",
|
|
97
108
|
};
|
|
98
|
-
mockedNetwork.mockResolvedValue(
|
|
99
|
-
|
|
109
|
+
mockedNetwork.mockResolvedValue(
|
|
110
|
+
createAxiosResponse({
|
|
100
111
|
result: "mockedResult",
|
|
101
112
|
se_firmware_osu_version: "mockedOsuFirmware",
|
|
102
|
-
},
|
|
103
|
-
|
|
113
|
+
}),
|
|
114
|
+
);
|
|
104
115
|
|
|
105
116
|
const result = await httpManagerApiRepository.fetchLatestFirmware(params);
|
|
106
117
|
|
|
@@ -119,9 +130,7 @@ describe("HttpManagerApiRepository", () => {
|
|
|
119
130
|
});
|
|
120
131
|
|
|
121
132
|
test("fetchMcus should return data", async () => {
|
|
122
|
-
mockedNetwork.mockResolvedValue(
|
|
123
|
-
data: "mockedData",
|
|
124
|
-
});
|
|
133
|
+
mockedNetwork.mockResolvedValue(createAxiosResponse("mockedData"));
|
|
125
134
|
|
|
126
135
|
const result = await httpManagerApiRepository.fetchMcus();
|
|
127
136
|
|
|
@@ -177,9 +186,7 @@ describe("HttpManagerApiRepository", () => {
|
|
|
177
186
|
});
|
|
178
187
|
|
|
179
188
|
test("getDeviceVersion should return data", async () => {
|
|
180
|
-
mockedNetwork.mockResolvedValue(
|
|
181
|
-
data: "mockedData",
|
|
182
|
-
});
|
|
189
|
+
mockedNetwork.mockResolvedValue(createAxiosResponse("mockedData"));
|
|
183
190
|
|
|
184
191
|
const result = await httpManagerApiRepository.getDeviceVersion({
|
|
185
192
|
targetId: 123,
|
|
@@ -212,9 +219,7 @@ describe("HttpManagerApiRepository", () => {
|
|
|
212
219
|
});
|
|
213
220
|
|
|
214
221
|
test("getCurrentOSU should return data", async () => {
|
|
215
|
-
mockedNetwork.mockResolvedValue(
|
|
216
|
-
data: "mockedData",
|
|
217
|
-
});
|
|
222
|
+
mockedNetwork.mockResolvedValue(createAxiosResponse("mockedData"));
|
|
218
223
|
|
|
219
224
|
const result = await httpManagerApiRepository.getCurrentOSU({
|
|
220
225
|
deviceId: 123,
|
|
@@ -278,9 +283,7 @@ describe("HttpManagerApiRepository", () => {
|
|
|
278
283
|
});
|
|
279
284
|
|
|
280
285
|
test("getCurrentFirmware should return data", async () => {
|
|
281
|
-
mockedNetwork.mockResolvedValue(
|
|
282
|
-
data: "mockedData",
|
|
283
|
-
});
|
|
286
|
+
mockedNetwork.mockResolvedValue(createAxiosResponse("mockedData"));
|
|
284
287
|
|
|
285
288
|
const result = await httpManagerApiRepository.getCurrentFirmware({
|
|
286
289
|
deviceId: 123,
|
|
@@ -303,9 +306,7 @@ describe("HttpManagerApiRepository", () => {
|
|
|
303
306
|
});
|
|
304
307
|
|
|
305
308
|
test("getFinalFirmwareById should return data", async () => {
|
|
306
|
-
mockedNetwork.mockResolvedValue(
|
|
307
|
-
data: "mockedData",
|
|
308
|
-
});
|
|
309
|
+
mockedNetwork.mockResolvedValue(createAxiosResponse("mockedData"));
|
|
309
310
|
|
|
310
311
|
const result = await httpManagerApiRepository.getFinalFirmwareById(123);
|
|
311
312
|
|
|
@@ -326,9 +327,7 @@ describe("HttpManagerApiRepository", () => {
|
|
|
326
327
|
});
|
|
327
328
|
|
|
328
329
|
test("getAppsByHash should throw a NetworkDown error if data is null", async () => {
|
|
329
|
-
mockedNetwork.mockResolvedValue(
|
|
330
|
-
data: null,
|
|
331
|
-
});
|
|
330
|
+
mockedNetwork.mockResolvedValue(createAxiosResponse(null));
|
|
332
331
|
|
|
333
332
|
await expect(httpManagerApiRepository.getAppsByHash(["mockedHash"])).rejects.toThrow(
|
|
334
333
|
NetworkDown,
|
|
@@ -336,9 +335,7 @@ describe("HttpManagerApiRepository", () => {
|
|
|
336
335
|
});
|
|
337
336
|
|
|
338
337
|
test("getAppsByHash should throw a NetworkDown error if data is not an array", async () => {
|
|
339
|
-
mockedNetwork.mockResolvedValue(
|
|
340
|
-
data: "mockedData",
|
|
341
|
-
});
|
|
338
|
+
mockedNetwork.mockResolvedValue(createAxiosResponse("mockedData"));
|
|
342
339
|
|
|
343
340
|
await expect(httpManagerApiRepository.getAppsByHash(["mockedHash"])).rejects.toThrow(
|
|
344
341
|
NetworkDown,
|
|
@@ -346,9 +343,7 @@ describe("HttpManagerApiRepository", () => {
|
|
|
346
343
|
});
|
|
347
344
|
|
|
348
345
|
test("getAppsByHash should return data if it's an array", async () => {
|
|
349
|
-
mockedNetwork.mockResolvedValue(
|
|
350
|
-
data: ["mockedData"],
|
|
351
|
-
});
|
|
346
|
+
mockedNetwork.mockResolvedValue(createAxiosResponse(["mockedData"]));
|
|
352
347
|
|
|
353
348
|
const result = await httpManagerApiRepository.getAppsByHash(["mockedHash"]);
|
|
354
349
|
|
|
@@ -373,9 +368,7 @@ describe("HttpManagerApiRepository", () => {
|
|
|
373
368
|
});
|
|
374
369
|
|
|
375
370
|
test("catalogForDevice should throw a NetworkDown error if data is null", async () => {
|
|
376
|
-
mockedNetwork.mockResolvedValue(
|
|
377
|
-
data: null,
|
|
378
|
-
});
|
|
371
|
+
mockedNetwork.mockResolvedValue(createAxiosResponse(null));
|
|
379
372
|
|
|
380
373
|
await expect(
|
|
381
374
|
httpManagerApiRepository.catalogForDevice({
|
|
@@ -387,9 +380,7 @@ describe("HttpManagerApiRepository", () => {
|
|
|
387
380
|
});
|
|
388
381
|
|
|
389
382
|
test("catalogForDevice should throw a NetworkDown error if data is not an array", async () => {
|
|
390
|
-
mockedNetwork.mockResolvedValue(
|
|
391
|
-
data: "mockedData",
|
|
392
|
-
});
|
|
383
|
+
mockedNetwork.mockResolvedValue(createAxiosResponse("mockedData"));
|
|
393
384
|
|
|
394
385
|
await expect(
|
|
395
386
|
httpManagerApiRepository.catalogForDevice({
|
|
@@ -401,9 +392,7 @@ describe("HttpManagerApiRepository", () => {
|
|
|
401
392
|
});
|
|
402
393
|
|
|
403
394
|
test("catalogForDevice should return data if it's an array", async () => {
|
|
404
|
-
mockedNetwork.mockResolvedValue(
|
|
405
|
-
data: ["mockedData"],
|
|
406
|
-
});
|
|
395
|
+
mockedNetwork.mockResolvedValue(createAxiosResponse(["mockedData"]));
|
|
407
396
|
|
|
408
397
|
const result = await httpManagerApiRepository.catalogForDevice({
|
|
409
398
|
targetId: 123,
|
|
@@ -455,8 +444,8 @@ describe("HttpManagerApiRepository", () => {
|
|
|
455
444
|
.spyOn(httpManagerApiRepository, "getCurrentFirmware")
|
|
456
445
|
.mockReturnValue(Promise.resolve({ id: mockedCurrentFirmwareId } as FinalFirmware));
|
|
457
446
|
|
|
458
|
-
mockedNetwork.mockResolvedValue(
|
|
459
|
-
|
|
447
|
+
mockedNetwork.mockResolvedValue(
|
|
448
|
+
createAxiosResponse([
|
|
460
449
|
{
|
|
461
450
|
language: "french",
|
|
462
451
|
language_package_version: [
|
|
@@ -487,8 +476,8 @@ describe("HttpManagerApiRepository", () => {
|
|
|
487
476
|
} as LanguagePackageEntity,
|
|
488
477
|
],
|
|
489
478
|
},
|
|
490
|
-
] as LanguagePackageResponseEntity[],
|
|
491
|
-
|
|
479
|
+
] as LanguagePackageResponseEntity[]),
|
|
480
|
+
);
|
|
492
481
|
|
|
493
482
|
const result = await httpManagerApiRepository.getLanguagePackagesForDevice(
|
|
494
483
|
{} as unknown as DeviceInfoEntity,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"customConditions": []
|
|
5
|
+
},
|
|
6
|
+
"exclude": [
|
|
7
|
+
"**/*.test.ts",
|
|
8
|
+
"**/*.test.tsx",
|
|
9
|
+
"**/*.spec.ts",
|
|
10
|
+
"**/*.spec.tsx",
|
|
11
|
+
"**/__tests__/**/*",
|
|
12
|
+
"**/tests/**/*",
|
|
13
|
+
"**/*.test.js",
|
|
14
|
+
"**/*.test.jsx",
|
|
15
|
+
"**/*.spec.js",
|
|
16
|
+
"**/*.spec.jsx"
|
|
17
|
+
]
|
|
18
|
+
}
|