@onekeyfe/hd-transport-web-device 1.2.2-alpha.110 → 1.2.2-alpha.111

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.
@@ -498,7 +498,7 @@ describe('ElectronBleTransport protocol detection', () => {
498
498
  await expect(result).resolves.toBe('rejected');
499
499
  });
500
500
 
501
- test('throws when both protocol probes fail', async () => {
501
+ test('disconnects when both protocol probes fail and reconnects for the next acquire', async () => {
502
502
  const device = { id: 'dead-device-id', name: 'Unknown Device' };
503
503
  const nobleBle = createNobleBle(device);
504
504
 
@@ -510,7 +510,25 @@ describe('ElectronBleTransport protocol detection', () => {
510
510
  await expect(transport.acquire({ uuid: device.id })).rejects.toThrow(
511
511
  /Unable to detect BLE protocol/
512
512
  );
513
+ expect(nobleBle.unsubscribe).toHaveBeenCalledWith(device.id);
514
+ expect(nobleBle.disconnect).toHaveBeenCalledWith(device.id);
513
515
  expect(transport.getProtocolType(device.id)).toBeUndefined();
516
+
517
+ echoProtocolV2(nobleBle, device.id);
518
+ await expect(
519
+ transport.acquire({ uuid: device.id, expectedProtocol: 'V2' })
520
+ ).resolves.toMatchObject({ uuid: device.id });
521
+ expect(nobleBle.connect).toHaveBeenCalledTimes(2);
522
+ expect(nobleBle.disconnect.mock.invocationCallOrder.at(-1)).toBeLessThan(
523
+ nobleBle.connect.mock.invocationCallOrder[1]
524
+ );
525
+ await expect(
526
+ transport.call(device.id, 'Ping', { message: 'after-reconnect' })
527
+ ).resolves.toMatchObject({
528
+ type: 'Success',
529
+ message: { message: 'ok' },
530
+ });
531
+ await transport.release(device.id);
514
532
  });
515
533
 
516
534
  test('surfaces Protocol V2 link disabled while the initial V1 probe is active', async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-transport-web-device",
3
- "version": "1.2.2-alpha.110",
3
+ "version": "1.2.2-alpha.111",
4
4
  "author": "OneKey",
5
5
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
6
6
  "license": "MIT",
@@ -21,13 +21,13 @@
21
21
  "lint:fix": "eslint . --fix"
22
22
  },
23
23
  "dependencies": {
24
- "@onekeyfe/hd-shared": "1.2.2-alpha.110",
25
- "@onekeyfe/hd-transport": "1.2.2-alpha.110"
24
+ "@onekeyfe/hd-shared": "1.2.2-alpha.111",
25
+ "@onekeyfe/hd-transport": "1.2.2-alpha.111"
26
26
  },
27
27
  "devDependencies": {
28
- "@onekeyfe/hd-transport-electron": "1.2.2-alpha.110",
28
+ "@onekeyfe/hd-transport-electron": "1.2.2-alpha.111",
29
29
  "@types/w3c-web-usb": "^1.0.6",
30
30
  "@types/web-bluetooth": "^0.0.17"
31
31
  },
32
- "gitHead": "80a959fb1e9383ce948b911fddece1265b40051f"
32
+ "gitHead": "a87be5a4ae4b59f91f853a9873a9e8e924bbdfd6"
33
33
  }