@neurodevs/ndx-native 1.0.1 → 2.0.0
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/build/__tests__/impl/LibndxAdapter.test.d.ts +44 -9
- package/build/__tests__/impl/LibndxAdapter.test.js +248 -52
- package/build/__tests__/impl/LibndxAdapter.test.js.map +1 -1
- package/build/impl/LibndxAdapter.d.ts +11 -0
- package/build/impl/LibndxAdapter.js +26 -2
- package/build/impl/LibndxAdapter.js.map +1 -1
- package/build/testDoubles/Libndx/FakeLibndx.d.ts +6 -1
- package/build/testDoubles/Libndx/FakeLibndx.js +21 -8
- package/build/testDoubles/Libndx/FakeLibndx.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/impl/LibndxAdapter.test.ts +297 -45
- package/src/impl/LibndxAdapter.ts +39 -2
- package/src/testDoubles/Libndx/FakeLibndx.ts +25 -8
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BleBackendOptions,
|
|
3
|
+
BleWriteOptions,
|
|
3
4
|
FtdiBackendOptions,
|
|
4
5
|
Libndx,
|
|
5
6
|
LibndxAdapterOptions,
|
|
@@ -9,62 +10,78 @@ export default class FakeLibndx implements Libndx {
|
|
|
9
10
|
public static callsToConstructor: (LibndxAdapterOptions | undefined)[] = []
|
|
10
11
|
public static callsToCreateBleBackend: BleBackendOptions[] = []
|
|
11
12
|
public static callsToStartBleBackend: BleBackendOptions[] = []
|
|
13
|
+
public static callsToWriteBle: BleWriteOptions[] = []
|
|
12
14
|
public static callsToStopBleBacked: BleBackendOptions[] = []
|
|
13
15
|
public static callsToDestroyBleBackend: BleBackendOptions[] = []
|
|
16
|
+
public static callsToGetRssiBleBackend: BleBackendOptions[] = []
|
|
14
17
|
public static callsToCreateFtdiBackend: FtdiBackendOptions[] = []
|
|
15
18
|
public static callsToStartFtdiBackend: FtdiBackendOptions[] = []
|
|
16
19
|
public static callsToStopFtdiBackend: FtdiBackendOptions[] = []
|
|
17
20
|
public static callsToDestroyFtdiBackend: FtdiBackendOptions[] = []
|
|
18
21
|
|
|
22
|
+
public static fakeResult = ''
|
|
23
|
+
|
|
19
24
|
public constructor(options?: LibndxAdapterOptions) {
|
|
20
25
|
FakeLibndx.callsToConstructor.push(options)
|
|
21
26
|
}
|
|
22
27
|
|
|
23
28
|
public createBleBackend(options: BleBackendOptions) {
|
|
24
29
|
FakeLibndx.callsToCreateBleBackend.push(options)
|
|
25
|
-
return
|
|
30
|
+
return FakeLibndx.fakeResult
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
public startBleBackend(options: BleBackendOptions) {
|
|
29
34
|
FakeLibndx.callsToStartBleBackend.push(options)
|
|
30
|
-
return
|
|
35
|
+
return FakeLibndx.fakeResult
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public writeBleCharacteristic(options: BleWriteOptions) {
|
|
39
|
+
FakeLibndx.callsToWriteBle.push(options)
|
|
40
|
+
return FakeLibndx.fakeResult
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public readBleRssi(options: BleBackendOptions) {
|
|
44
|
+
FakeLibndx.callsToGetRssiBleBackend.push(options)
|
|
45
|
+
return FakeLibndx.fakeResult
|
|
31
46
|
}
|
|
32
47
|
|
|
33
48
|
public stopBleBackend(options: BleBackendOptions) {
|
|
34
49
|
FakeLibndx.callsToStopBleBacked.push(options)
|
|
35
|
-
return
|
|
50
|
+
return FakeLibndx.fakeResult
|
|
36
51
|
}
|
|
37
52
|
|
|
38
53
|
public destroyBleBackend(options: BleBackendOptions) {
|
|
39
54
|
FakeLibndx.callsToDestroyBleBackend.push(options)
|
|
40
|
-
return
|
|
55
|
+
return FakeLibndx.fakeResult
|
|
41
56
|
}
|
|
42
57
|
|
|
43
58
|
public createFtdiBackend(options: FtdiBackendOptions) {
|
|
44
59
|
FakeLibndx.callsToCreateFtdiBackend.push(options)
|
|
45
|
-
return
|
|
60
|
+
return FakeLibndx.fakeResult
|
|
46
61
|
}
|
|
47
62
|
|
|
48
63
|
public startFtdiBackend(options: FtdiBackendOptions) {
|
|
49
64
|
FakeLibndx.callsToStartFtdiBackend.push(options)
|
|
50
|
-
return
|
|
65
|
+
return FakeLibndx.fakeResult
|
|
51
66
|
}
|
|
52
67
|
|
|
53
68
|
public stopFtdiBackend(options: FtdiBackendOptions) {
|
|
54
69
|
FakeLibndx.callsToStopFtdiBackend.push(options)
|
|
55
|
-
return
|
|
70
|
+
return FakeLibndx.fakeResult
|
|
56
71
|
}
|
|
57
72
|
|
|
58
73
|
public destroyFtdiBackend(options: FtdiBackendOptions) {
|
|
59
74
|
FakeLibndx.callsToDestroyFtdiBackend.push(options)
|
|
60
|
-
return
|
|
75
|
+
return FakeLibndx.fakeResult
|
|
61
76
|
}
|
|
62
77
|
|
|
63
78
|
public static resetTestDouble() {
|
|
64
79
|
FakeLibndx.callsToConstructor = []
|
|
65
80
|
FakeLibndx.callsToCreateBleBackend = []
|
|
66
81
|
FakeLibndx.callsToStartBleBackend = []
|
|
82
|
+
FakeLibndx.callsToWriteBle = []
|
|
67
83
|
FakeLibndx.callsToStopBleBacked = []
|
|
84
|
+
FakeLibndx.callsToGetRssiBleBackend = []
|
|
68
85
|
FakeLibndx.callsToDestroyBleBackend = []
|
|
69
86
|
FakeLibndx.callsToCreateFtdiBackend = []
|
|
70
87
|
FakeLibndx.callsToStartFtdiBackend = []
|