@onekeyfe/hd-transport-web-device 1.2.8-alpha.100 → 1.2.8-alpha.101
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/__tests__/electron-ble-transport.test.ts +11 -7
- package/__tests__/webusb-identity-probe.test.ts +887 -0
- package/__tests__/webusb-protocol-v2-timeout.test.ts +18 -5
- package/dist/electron-ble-transport.d.ts.map +1 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +296 -27
- package/dist/webusb.d.ts +17 -1
- package/dist/webusb.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/electron-ble-transport.ts +4 -8
- package/src/webusb.ts +290 -32
|
@@ -561,9 +561,9 @@ describe('ElectronBleTransport protocol detection', () => {
|
|
|
561
561
|
|
|
562
562
|
const transport = configureTransport(nobleBle);
|
|
563
563
|
|
|
564
|
-
await expect(transport.acquire({ uuid: device.id })).rejects.
|
|
565
|
-
|
|
566
|
-
);
|
|
564
|
+
await expect(transport.acquire({ uuid: device.id })).rejects.toMatchObject({
|
|
565
|
+
errorCode: HardwareErrorCode.TransportProtocolProbeFailed,
|
|
566
|
+
});
|
|
567
567
|
expect(nobleBle.unsubscribe).toHaveBeenCalledWith(device.id);
|
|
568
568
|
expect(nobleBle.disconnect).toHaveBeenCalledWith(device.id);
|
|
569
569
|
expect(transport.getProtocolType(device.id)).toBeUndefined();
|
|
@@ -629,7 +629,8 @@ describe('ElectronBleTransport protocol detection', () => {
|
|
|
629
629
|
await expect(
|
|
630
630
|
transport.acquire({ uuid: device.id, expectedProtocol: 'V2' })
|
|
631
631
|
).rejects.toMatchObject({
|
|
632
|
-
errorCode: HardwareErrorCode.
|
|
632
|
+
errorCode: HardwareErrorCode.TransportProtocolProbeFailed,
|
|
633
|
+
params: { expectedProtocol: 'V2' },
|
|
633
634
|
});
|
|
634
635
|
|
|
635
636
|
expect(nobleBle.connect).toHaveBeenCalledTimes(1);
|
|
@@ -645,12 +646,14 @@ describe('ElectronBleTransport protocol detection', () => {
|
|
|
645
646
|
await expect(
|
|
646
647
|
transport.acquire({ uuid: device.id, expectedProtocol: 'V2' })
|
|
647
648
|
).rejects.toMatchObject({
|
|
648
|
-
errorCode: HardwareErrorCode.
|
|
649
|
+
errorCode: HardwareErrorCode.TransportProtocolProbeFailed,
|
|
650
|
+
params: { expectedProtocol: 'V2' },
|
|
649
651
|
});
|
|
650
652
|
await expect(
|
|
651
653
|
transport.acquire({ uuid: device.id, expectedProtocol: 'V2' })
|
|
652
654
|
).rejects.toMatchObject({
|
|
653
|
-
errorCode: HardwareErrorCode.
|
|
655
|
+
errorCode: HardwareErrorCode.TransportProtocolProbeFailed,
|
|
656
|
+
params: { expectedProtocol: 'V2' },
|
|
654
657
|
});
|
|
655
658
|
|
|
656
659
|
expect(transport.getProtocolType(device.id)).toBeUndefined();
|
|
@@ -755,7 +758,8 @@ describe('ElectronBleTransport protocol detection', () => {
|
|
|
755
758
|
await expect(
|
|
756
759
|
transport.acquire({ uuid: device.id, expectedProtocol: 'V2' })
|
|
757
760
|
).rejects.toMatchObject({
|
|
758
|
-
errorCode: HardwareErrorCode.
|
|
761
|
+
errorCode: HardwareErrorCode.TransportProtocolProbeFailed,
|
|
762
|
+
params: { expectedProtocol: 'V2' },
|
|
759
763
|
});
|
|
760
764
|
|
|
761
765
|
expect(nobleBle.unsubscribe).toHaveBeenCalledWith(device.id);
|