@onekeyfe/hd-core 1.2.2-alpha.1 → 1.2.2-alpha.100

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.
Files changed (69) hide show
  1. package/__tests__/AllNetworkGetAddressBase.tracing.test.ts +4 -20
  2. package/__tests__/DeviceCommands.test.ts +0 -13
  3. package/__tests__/check-all-firmware-release-protocol-v2.test.ts +2 -0
  4. package/__tests__/check-firmware-release-protocol-v2.test.ts +2 -0
  5. package/__tests__/device-lifecycle-events.test.ts +0 -19
  6. package/__tests__/deviceUploadNft.test.ts +0 -68
  7. package/__tests__/evmSignTypedData.test.ts +0 -42
  8. package/__tests__/firmware-update/firmware-update-v4-install-poll.test.ts +12 -825
  9. package/__tests__/open-wallet-session.test.ts +1 -127
  10. package/__tests__/protocol-v2-resources.test.ts +4 -7
  11. package/__tests__/protocol-v2-unlock-policy.test.ts +1 -35
  12. package/__tests__/protocol-v2.test.ts +27 -710
  13. package/dist/api/FirmwareUpdateV4.d.ts +0 -4
  14. package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
  15. package/dist/api/OpenWalletSession.d.ts.map +1 -1
  16. package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
  17. package/dist/api/evm/EVMSignTypedData.d.ts.map +1 -1
  18. package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts +2 -2
  19. package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
  20. package/dist/api/firmware/getBinary.d.ts +2 -2
  21. package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts.map +1 -1
  22. package/dist/api/protocol-v2/DeviceUploadNft.d.ts.map +1 -1
  23. package/dist/api/protocol-v2/DeviceUploadWallpaper.d.ts.map +1 -1
  24. package/dist/api/protocol-v2/helpers.d.ts.map +1 -1
  25. package/dist/core/index.d.ts +0 -1
  26. package/dist/core/index.d.ts.map +1 -1
  27. package/dist/device/Device.d.ts +1 -1
  28. package/dist/device/Device.d.ts.map +1 -1
  29. package/dist/device/DeviceConnector.d.ts +1 -1
  30. package/dist/device/DeviceConnector.d.ts.map +1 -1
  31. package/dist/events/ui-request.d.ts +0 -3
  32. package/dist/events/ui-request.d.ts.map +1 -1
  33. package/dist/index.d.ts +5 -21
  34. package/dist/index.js +402 -1136
  35. package/dist/protocols/protocol-v2/resources.d.ts.map +1 -1
  36. package/dist/protocols/protocol-v2/unlockPolicyRunner.d.ts +0 -2
  37. package/dist/protocols/protocol-v2/unlockPolicyRunner.d.ts.map +1 -1
  38. package/dist/protocols/protocol-v2/walletSession.d.ts +0 -3
  39. package/dist/protocols/protocol-v2/walletSession.d.ts.map +1 -1
  40. package/dist/types/settings.d.ts +2 -2
  41. package/dist/types/settings.d.ts.map +1 -1
  42. package/dist/utils/deviceFeaturesUtils.d.ts +0 -3
  43. package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
  44. package/dist/utils/patch.d.ts +1 -1
  45. package/dist/utils/patch.d.ts.map +1 -1
  46. package/package.json +4 -4
  47. package/src/api/FirmwareUpdateV4.ts +75 -434
  48. package/src/api/OpenWalletSession.ts +9 -39
  49. package/src/api/allnetwork/AllNetworkGetAddressBase.ts +1 -2
  50. package/src/api/evm/EVMSignTypedData.ts +0 -1
  51. package/src/api/firmware/FirmwareUpdateBaseMethod.ts +3 -9
  52. package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +1 -7
  53. package/src/api/protocol-v2/DeviceUploadNft.ts +8 -31
  54. package/src/api/protocol-v2/DeviceUploadWallpaper.ts +8 -27
  55. package/src/api/protocol-v2/helpers.ts +0 -8
  56. package/src/core/index.ts +10 -121
  57. package/src/data/messages/messages-protocol-v2.json +1 -111
  58. package/src/device/Device.ts +1 -3
  59. package/src/device/DeviceConnector.ts +3 -7
  60. package/src/events/ui-request.ts +0 -3
  61. package/src/protocols/protocol-v2/resources.ts +1 -9
  62. package/src/protocols/protocol-v2/unlockPolicyRunner.ts +1 -8
  63. package/src/protocols/protocol-v2/walletSession.ts +22 -65
  64. package/src/types/settings.ts +2 -4
  65. package/src/utils/deviceFeaturesUtils.ts +0 -4
  66. package/__tests__/pro2HostAssetPackage.test.ts +0 -58
  67. package/dist/utils/pro2HostAssetPackage.d.ts +0 -8
  68. package/dist/utils/pro2HostAssetPackage.d.ts.map +0 -1
  69. package/src/utils/pro2HostAssetPackage.ts +0 -354
@@ -254,88 +254,6 @@ describe('DeviceUploadWallpaper', () => {
254
254
  });
255
255
  });
256
256
 
257
- test('uploads and applies the fixed wallpaper package on firmware 1.0.1', async () => {
258
- const typedCall = jest.fn().mockImplementation((request, _response, params) => {
259
- if (request === 'FilesystemDirMake') return { message: {} };
260
- if (request === 'FilesystemFileWrite') {
261
- const file = params.file as { data: Uint8Array; offset: number };
262
- return { message: { processed_byte: file.offset + file.data.byteLength } };
263
- }
264
- if (request === 'DeviceSettingsSet') {
265
- return { message: { message: 'wallpaper applied' } };
266
- }
267
- throw new Error(`Unexpected request: ${request}`);
268
- });
269
- const method = new DeviceUploadWallpaper({
270
- id: 1,
271
- payload: {
272
- method: 'deviceUploadWallpaper',
273
- jpegBase64: createJpegBase64(604, 1024),
274
- fileName: 'ignored-on-package-firmware.bin',
275
- },
276
- });
277
- const device = stubWallpaperDevice({
278
- commands: { typedCall },
279
- state: { versions: { firmware: '1.0.1' } },
280
- getCurrentFirmwareVersionString: jest.fn(() => '1.0.1'),
281
- });
282
- (method as any).device = device;
283
- method.postMessage = jest.fn();
284
-
285
- method.init();
286
- const result = await method.run();
287
-
288
- const fileWrites = typedCall.mock.calls.filter(call => call[0] === 'FilesystemFileWrite');
289
- expect(new Set(fileWrites.map(call => call[2].file.path))).toEqual(
290
- new Set(['vol1:/wallpapers/wallpaper.okpkg'])
291
- );
292
- expect(fileWrites[0][2].file.data.subarray(0, 4)).toEqual(
293
- new Uint8Array([0x4f, 0x4b, 0x50, 0x50])
294
- );
295
- expect(typedCall).toHaveBeenLastCalledWith('DeviceSettingsSet', 'Success', {
296
- settings: { wallpaper_path: 'vol1:/wallpapers/wallpaper.okpkg' },
297
- });
298
- expect(result).toMatchObject({
299
- path: 'vol1:/wallpapers/wallpaper.okpkg',
300
- colorFormat: 'RGB565',
301
- message: 'wallpaper applied',
302
- });
303
- });
304
-
305
- test('keeps the legacy wallpaper path on a 1.0.1 prerelease', async () => {
306
- const typedCall = jest.fn().mockImplementation((request, _response, params) => {
307
- if (request === 'FilesystemDirMake') return { message: {} };
308
- if (request === 'FilesystemFileWrite') {
309
- const file = params.file as { data: Uint8Array; offset: number };
310
- return { message: { processed_byte: file.offset + file.data.byteLength } };
311
- }
312
- if (request === 'DeviceSettingsSet') return { message: {} };
313
- throw new Error(`Unexpected request: ${request}`);
314
- });
315
- const method = new DeviceUploadWallpaper({
316
- id: 1,
317
- payload: {
318
- method: 'deviceUploadWallpaper',
319
- jpegBase64: createJpegBase64(604, 1024),
320
- fileName: 'prerelease-wallpaper.bin',
321
- },
322
- });
323
- const device = stubWallpaperDevice({
324
- commands: { typedCall },
325
- state: { versions: { firmware: '1.0.1-beta.1' } },
326
- });
327
- (method as any).device = device;
328
-
329
- method.init();
330
- const result = await method.run();
331
-
332
- expect(result.path).toBe('vol1:/wallpapers/prerelease-wallpaper.bin');
333
- const fileWrites = typedCall.mock.calls.filter(call => call[0] === 'FilesystemFileWrite');
334
- expect(new Set(fileWrites.map(call => call[2].file.path))).toEqual(
335
- new Set(['vol1:/wallpapers/prerelease-wallpaper.bin'])
336
- );
337
- });
338
-
339
257
  test('文件上传失败时不修改 wallpaper_path', async () => {
340
258
  const typedCall = jest.fn().mockImplementation(request => {
341
259
  if (request === 'FilesystemDirMake') return { message: {} };
@@ -1104,7 +1022,6 @@ describe('Protocol V2 feature adapter', () => {
1104
1022
  newSession: 'session-1',
1105
1023
  unlockedAttachPin: false,
1106
1024
  resumed: false,
1107
- walletStatusRefreshed: true,
1108
1025
  });
1109
1026
  expect(typedCall).toHaveBeenCalledWith('ProtocolInfoRequest', 'ProtocolInfo', {
1110
1027
  eventless_wallet_session: true,
@@ -1368,7 +1285,6 @@ describe('Protocol V2 feature adapter', () => {
1368
1285
  newSession: 'main-wallet-session',
1369
1286
  unlockedAttachPin: undefined,
1370
1287
  resumed: false,
1371
- walletStatusRefreshed: true,
1372
1288
  });
1373
1289
 
1374
1290
  expect(promptPassphrase).toHaveBeenCalled();
@@ -1455,7 +1371,6 @@ describe('Protocol V2 feature adapter', () => {
1455
1371
  newSession: 'hidden-after-unlock-session',
1456
1372
  unlockedAttachPin: undefined,
1457
1373
  resumed: false,
1458
- walletStatusRefreshed: true,
1459
1374
  });
1460
1375
 
1461
1376
  expect(unlockDevice).not.toHaveBeenCalled();
@@ -4905,23 +4820,6 @@ describe('Protocol V2 firmware update targets', () => {
4905
4820
  expect(typedCall.mock.calls.map(call => call[0])).toEqual(['DeviceInfoGet']);
4906
4821
  });
4907
4822
 
4908
- test('stops V4 bootloader reconnect polling on a stale BLE bond', async () => {
4909
- const method = new FirmwareUpdateV4({
4910
- id: 1,
4911
- payload: {
4912
- method: 'firmwareUpdateV4',
4913
- },
4914
- });
4915
- const staleBondError = ERRORS.TypedError(HardwareErrorCode.BlePeerRemovedPairingInformation);
4916
- const reconnectProtocolV2Device = jest.fn().mockRejectedValue(staleBondError);
4917
- (method as any).reconnectProtocolV2Device = reconnectProtocolV2Device;
4918
-
4919
- await expect((method as any).waitForProtocolV2BootloaderMode(60_000, 0)).rejects.toBe(
4920
- staleBondError
4921
- );
4922
- expect(reconnectProtocolV2Device).toHaveBeenCalledTimes(1);
4923
- });
4924
-
4925
4823
  test('polls again when Protocol V2 bootloader serial is temporarily unavailable', async () => {
4926
4824
  const method = new FirmwareUpdateV4({
4927
4825
  id: 1,
@@ -5003,87 +4901,6 @@ describe('Protocol V2 firmware update targets', () => {
5003
4901
  expect(initialize).not.toHaveBeenCalled();
5004
4902
  });
5005
4903
 
5006
- test('reacquires the same WebUSB device without a protocol probe during install recovery', async () => {
5007
- const method = new FirmwareUpdateV4({
5008
- id: 1,
5009
- payload: {
5010
- method: 'firmwareUpdateV4',
5011
- },
5012
- });
5013
- const acquire = jest.fn().mockResolvedValue('usb-path');
5014
- const enumerate = jest.fn().mockResolvedValue({
5015
- descriptors: [
5016
- { id: 'other-usb', path: 'other-usb', protocolType: 'V2' },
5017
- { id: 'usb-id', path: 'usb-path', protocolType: 'V2' },
5018
- ],
5019
- });
5020
- const commands = { disposed: true, mainId: '' };
5021
- const device = stubDevice({
5022
- originalDescriptor: { id: 'usb-id', path: 'usb-path', protocolType: 'V2' },
5023
- deviceConnector: { acquire, enumerate },
5024
- updateDescriptor: jest.fn(),
5025
- acquire: jest.fn(),
5026
- commands,
5027
- getCommands: () => commands,
5028
- mainId: 'old-usb-path',
5029
- });
5030
- const getDevices = jest.spyOn(DevicePool, 'getDevices');
5031
- const isBrowserWebUsb = jest.spyOn(DataManager, 'isBrowserWebUsb').mockReturnValue(false);
5032
- const isDesktopWebUsb = jest.spyOn(DataManager, 'isDesktopWebUsb').mockReturnValue(true);
5033
- (method as any).device = device;
5034
- (method as any).protocolV2ExpectedPath = 'usb-path';
5035
-
5036
- try {
5037
- await (method as any).reconnectProtocolV2Device({ skipProtocolProbe: true });
5038
- } finally {
5039
- getDevices.mockRestore();
5040
- isBrowserWebUsb.mockRestore();
5041
- isDesktopWebUsb.mockRestore();
5042
- }
5043
-
5044
- expect(getDevices).not.toHaveBeenCalled();
5045
- expect(acquire).toHaveBeenCalledWith(
5046
- 'usb-path',
5047
- null,
5048
- undefined,
5049
- 'V2',
5050
- undefined,
5051
- undefined,
5052
- true
5053
- );
5054
- expect(device.acquire).not.toHaveBeenCalled();
5055
- expect(commands.disposed).toBe(false);
5056
- expect(commands.mainId).toBe('usb-path');
5057
- });
5058
-
5059
- test('reacquires the same BLE peripheral by id without scanning during install recovery', async () => {
5060
- const method = new FirmwareUpdateV4({
5061
- id: 1,
5062
- payload: {
5063
- method: 'firmwareUpdateV4',
5064
- },
5065
- });
5066
- const acquire = jest.fn().mockResolvedValue({ uuid: 'ble-id', protocolType: 'V2' });
5067
- const enumerate = jest.fn().mockResolvedValue({
5068
- descriptors: [{ id: 'ble-id', name: 'OneKey Pro 2', protocolType: 'V2' }],
5069
- });
5070
- const commands = { disposed: true, mainId: '' };
5071
- (method as any).isBleReconnect = jest.fn(() => true);
5072
- (method as any).device = stubDevice({
5073
- originalDescriptor: { id: 'ble-id', path: 'ble-path', protocolType: 'V2' },
5074
- deviceConnector: { acquire, enumerate },
5075
- commands,
5076
- getCommands: () => commands,
5077
- });
5078
-
5079
- await (method as any).reconnectProtocolV2Device({ skipProtocolProbe: true });
5080
-
5081
- expect(enumerate).not.toHaveBeenCalled();
5082
- expect(acquire).toHaveBeenCalledWith('ble-id', null, true, 'V2', undefined, undefined, true);
5083
- expect(commands.disposed).toBe(false);
5084
- expect(commands.mainId).toBe('ble-id');
5085
- });
5086
-
5087
4904
  test('selects the matching physical device from multiple Protocol V2 USB reconnect candidates', async () => {
5088
4905
  const method = new FirmwareUpdateV4({
5089
4906
  id: 1,
@@ -5473,108 +5290,6 @@ describe('Protocol V2 firmware update targets', () => {
5473
5290
  });
5474
5291
  });
5475
5292
 
5476
- test('treats a typed BLE disconnect during Protocol V2 normal reboot as expected', async () => {
5477
- const method = new FirmwareUpdateV4({
5478
- id: 1,
5479
- payload: {
5480
- method: 'firmwareUpdateV4',
5481
- },
5482
- });
5483
- const typedCall = jest
5484
- .fn()
5485
- .mockRejectedValue(ERRORS.TypedError(HardwareErrorCode.BleDeviceDisconnected));
5486
-
5487
- (method as any).device = stubDevice({
5488
- getCommands: () => ({ typedCall }),
5489
- });
5490
-
5491
- await expect((method as any).protocolV2Reboot(DeviceRebootType.Normal)).resolves.toEqual({
5492
- message: 'Device rebooted successfully',
5493
- });
5494
- expect((method as any).device.markProtocolV2Reboot).toHaveBeenCalledWith(
5495
- DeviceRebootType.Normal
5496
- );
5497
- });
5498
-
5499
- test('uses a short timeout and continues after a BLE reboot response timeout', async () => {
5500
- const method = new FirmwareUpdateV4({
5501
- id: 1,
5502
- payload: {
5503
- method: 'firmwareUpdateV4',
5504
- },
5505
- });
5506
- const typedCall = jest
5507
- .fn()
5508
- .mockRejectedValue(
5509
- ERRORS.TypedError(
5510
- HardwareErrorCode.BleTimeoutError,
5511
- 'Lowlevel response timeout after 5000ms for DeviceReboot'
5512
- )
5513
- );
5514
-
5515
- (method as any).device = stubDevice({
5516
- getCommands: () => ({ typedCall }),
5517
- });
5518
-
5519
- await expect((method as any).protocolV2Reboot(DeviceRebootType.Normal)).resolves.toEqual({
5520
- message: 'Device rebooted successfully',
5521
- });
5522
- expect(typedCall).toHaveBeenCalledWith(
5523
- 'DeviceReboot',
5524
- 'Success',
5525
- { reboot_type: DeviceRebootType.Normal },
5526
- { timeoutMs: 5000 }
5527
- );
5528
- expect((method as any).device.markProtocolV2Reboot).toHaveBeenCalledWith(
5529
- DeviceRebootType.Normal
5530
- );
5531
- });
5532
-
5533
- test('continues after a USB Protocol V2 reboot response timeout', async () => {
5534
- const method = new FirmwareUpdateV4({
5535
- id: 1,
5536
- payload: {
5537
- method: 'firmwareUpdateV4',
5538
- },
5539
- });
5540
- const timeoutError = Object.assign(
5541
- new Error('Protocol V2 response timeout after 5000ms for DeviceReboot'),
5542
- { code: 'response-timeout' }
5543
- );
5544
- const typedCall = jest.fn().mockRejectedValue(timeoutError);
5545
-
5546
- (method as any).device = stubDevice({
5547
- getCommands: () => ({ typedCall }),
5548
- });
5549
-
5550
- await expect((method as any).protocolV2Reboot(DeviceRebootType.Normal)).resolves.toEqual({
5551
- message: 'Device rebooted successfully',
5552
- });
5553
- expect((method as any).device.markProtocolV2Reboot).toHaveBeenCalledWith(
5554
- DeviceRebootType.Normal
5555
- );
5556
- });
5557
-
5558
- test('propagates non-transport errors from a Protocol V2 reboot', async () => {
5559
- const method = new FirmwareUpdateV4({
5560
- id: 1,
5561
- payload: {
5562
- method: 'firmwareUpdateV4',
5563
- },
5564
- });
5565
- const rebootError = new Error('Device rejected reboot');
5566
- const typedCall = jest.fn().mockRejectedValue(rebootError);
5567
-
5568
- (method as any).device = stubDevice({
5569
- getCommands: () => ({ typedCall }),
5570
- });
5571
-
5572
- await expect((method as any).protocolV2Reboot(DeviceRebootType.Normal)).rejects.toBe(
5573
- rebootError
5574
- );
5575
- expect((method as any).device.markProtocolV2Reboot).not.toHaveBeenCalled();
5576
- });
5577
-
5578
5293
  test('treats Android BLE transport release during Protocol V2 reboot as expected', async () => {
5579
5294
  const method = new FirmwareUpdateV4({
5580
5295
  id: 1,
@@ -5650,11 +5365,7 @@ describe('Protocol V2 firmware update targets', () => {
5650
5365
  expect(call).toHaveBeenCalledWith(
5651
5366
  'DeviceFirmwareUpdateRequest',
5652
5367
  {},
5653
- expect.objectContaining({
5654
- returnAfterWrite: true,
5655
- expectedTypes: ['Success'],
5656
- onResponseAfterWrite: expect.any(Function),
5657
- })
5368
+ { returnAfterWrite: true }
5658
5369
  );
5659
5370
  expect(typedCall.mock.invocationCallOrder[0]).toBeLessThan(call.mock.invocationCallOrder[0]);
5660
5371
  expect((method.postMessage as jest.Mock).mock.invocationCallOrder[0]).toBeLessThan(
@@ -5695,7 +5406,7 @@ describe('Protocol V2 firmware update targets', () => {
5695
5406
  expect(method.postProgressMessage).not.toHaveBeenCalled();
5696
5407
  });
5697
5408
 
5698
- test('does not enter install state when the empty request fails', async () => {
5409
+ test('does not enter install state when writing the empty request fails', async () => {
5699
5410
  const method = new FirmwareUpdateV4({
5700
5411
  id: 1,
5701
5412
  payload: {
@@ -5703,7 +5414,7 @@ describe('Protocol V2 firmware update targets', () => {
5703
5414
  },
5704
5415
  });
5705
5416
  const typedCall = jest.fn().mockResolvedValue({ type: 'Success', message: {} });
5706
- const call = jest.fn().mockRejectedValue(new Error('request failed'));
5417
+ const call = jest.fn().mockRejectedValue(new Error('write failed'));
5707
5418
 
5708
5419
  (method as any).device = stubDevice({
5709
5420
  getCommands: () => ({ typedCall, call }),
@@ -5718,118 +5429,13 @@ describe('Protocol V2 firmware update targets', () => {
5718
5429
  (method as any).protocolV2StartFirmwareUpdate({
5719
5430
  targets: [{ target_id: 4, path: 'vol0:/application_p1.bin' }],
5720
5431
  })
5721
- ).rejects.toThrow('request failed');
5432
+ ).rejects.toThrow('write failed');
5722
5433
 
5723
- expect(call).toHaveBeenCalledWith(
5724
- 'DeviceFirmwareUpdateRequest',
5725
- {},
5726
- expect.objectContaining({
5727
- returnAfterWrite: true,
5728
- expectedTypes: ['Success'],
5729
- onResponseAfterWrite: expect.any(Function),
5730
- })
5731
- );
5434
+ expect(call).toHaveBeenCalledTimes(1);
5732
5435
  expect(method.postTipMessage).not.toHaveBeenCalled();
5733
5436
  expect(method.postProgressMessage).not.toHaveBeenCalled();
5734
5437
  });
5735
5438
 
5736
- test('continues to install polling when the empty request releases BLE transport', async () => {
5737
- const method = new FirmwareUpdateV4({
5738
- id: 1,
5739
- payload: {
5740
- method: 'firmwareUpdateV4',
5741
- },
5742
- });
5743
- const typedCall = jest.fn().mockResolvedValue({ type: 'Success', message: {} });
5744
- const call = jest.fn().mockRejectedValue(new Error('React Native BLE transport released'));
5745
-
5746
- (method as any).device = stubDevice({
5747
- getCommands: () => ({ typedCall, call }),
5748
- createProtocolV2UiPhaseMetadata: jest.fn().mockReturnValue(undefined),
5749
- toMessageObject: jest.fn().mockReturnValue({ connectId: 'pro2' }),
5750
- });
5751
- (method as any).isBleReconnect = jest.fn(() => true);
5752
- method.postMessage = jest.fn();
5753
-
5754
- await expect(
5755
- (method as any).protocolV2StartFirmwareUpdate({
5756
- targets: [{ target_id: 4, path: 'vol0:/application_p1.bin' }],
5757
- })
5758
- ).resolves.toBeUndefined();
5759
-
5760
- expect(call).toHaveBeenCalledWith(
5761
- 'DeviceFirmwareUpdateRequest',
5762
- {},
5763
- expect.objectContaining({
5764
- returnAfterWrite: true,
5765
- expectedTypes: ['Success'],
5766
- onResponseAfterWrite: expect.any(Function),
5767
- })
5768
- );
5769
- expect(typedCall).not.toHaveBeenCalledWith('DeviceFirmwareUpdateRequest', 'Success', {});
5770
- expect((method as any).protocolV2InstallNeedsReconnect).toBe(true);
5771
- expect((method as any).protocolV2InstallDisconnectObserved).toBe(true);
5772
- });
5773
-
5774
- test.each([
5775
- { name: 'bootloader', targetId: 3, path: 'vol0:/bootloader.bin' },
5776
- { name: 'application', targetId: 4, path: 'vol0:/application_p1.bin' },
5777
- { name: 'secure element', targetId: 7, path: 'vol0:/se01.bin' },
5778
- ])(
5779
- 'reconnects a released BLE install link before polling $name status without DeviceInfo',
5780
- async ({ targetId, path }) => {
5781
- const method = new FirmwareUpdateV4({
5782
- id: 1,
5783
- payload: {
5784
- method: 'firmwareUpdateV4',
5785
- },
5786
- });
5787
- const targets = [{ target_id: targetId, path }];
5788
- const typedCall = jest
5789
- .fn()
5790
- .mockResolvedValueOnce({
5791
- type: 'DeviceFirmwareUpdateStatus',
5792
- message: { records: [{ ...targets[0], status: 1, payload_version: 0 }] },
5793
- })
5794
- .mockResolvedValueOnce({
5795
- type: 'DeviceFirmwareUpdateStatus',
5796
- message: { records: [{ ...targets[0], status: 2, payload_version: 0x010000 }] },
5797
- });
5798
- const reconnectProtocolV2Device = jest.fn().mockResolvedValue(undefined);
5799
- const verifyProtocolV2ReconnectIdentity = jest.fn();
5800
- const setTimeoutSpy = jest.spyOn(global, 'setTimeout').mockImplementation(((
5801
- callback: () => void
5802
- ) => {
5803
- callback();
5804
- return 0 as any;
5805
- }) as typeof setTimeout);
5806
-
5807
- (method as any).device = stubDevice({
5808
- getCommands: () => ({ typedCall }),
5809
- });
5810
- (method as any).isBleReconnect = jest.fn(() => true);
5811
- (method as any).protocolV2InstallNeedsReconnect = true;
5812
- (method as any).reconnectProtocolV2Device = reconnectProtocolV2Device;
5813
- (method as any).verifyProtocolV2ReconnectIdentity = verifyProtocolV2ReconnectIdentity;
5814
- method.postProgressMessage = jest.fn();
5815
-
5816
- try {
5817
- await expect(
5818
- (method as any).waitForProtocolV2FirmwareUpdateComplete(targets, true)
5819
- ).resolves.toBeUndefined();
5820
- } finally {
5821
- setTimeoutSpy.mockRestore();
5822
- }
5823
-
5824
- expect(reconnectProtocolV2Device).toHaveBeenCalledWith({ skipProtocolProbe: true });
5825
- expect(verifyProtocolV2ReconnectIdentity).not.toHaveBeenCalled();
5826
- expect(typedCall.mock.calls.map(callArgs => callArgs[0])).toEqual([
5827
- 'DeviceFirmwareUpdateStatusGet',
5828
- 'DeviceFirmwareUpdateStatusGet',
5829
- ]);
5830
- }
5831
- );
5832
-
5833
5439
  test('polls only firmware status while Protocol V2 bootloader is installing', async () => {
5834
5440
  const method = new FirmwareUpdateV4({
5835
5441
  id: 1,
@@ -5873,7 +5479,7 @@ describe('Protocol V2 firmware update targets', () => {
5873
5479
  expect(method.postProgressMessage).toHaveBeenCalledWith(100, 'installingFirmware');
5874
5480
  });
5875
5481
 
5876
- test('keeps polling after an empty status response until the target finishes', async () => {
5482
+ test('keeps polling after install ACK until the target finishes', async () => {
5877
5483
  const method = new FirmwareUpdateV4({
5878
5484
  id: 1,
5879
5485
  payload: {
@@ -5882,10 +5488,7 @@ describe('Protocol V2 firmware update targets', () => {
5882
5488
  });
5883
5489
  const typedCall = jest
5884
5490
  .fn()
5885
- .mockResolvedValueOnce({
5886
- type: 'DeviceFirmwareUpdateStatus',
5887
- message: { records: [] },
5888
- })
5491
+ .mockResolvedValueOnce({ type: 'Success', message: {} })
5889
5492
  .mockResolvedValueOnce({
5890
5493
  type: 'DeviceFirmwareUpdateStatus',
5891
5494
  message: { records: [] },
@@ -6027,38 +5630,6 @@ describe('Protocol V2 firmware update targets', () => {
6027
5630
  expect(method.postProgressMessage).toHaveBeenCalledWith(100, 'installingFirmware');
6028
5631
  });
6029
5632
 
6030
- test('does not count a stale finished target when only another target was live', () => {
6031
- const method = new FirmwareUpdateV4({
6032
- id: 1,
6033
- payload: {
6034
- method: 'firmwareUpdateV4',
6035
- },
6036
- });
6037
- const assertProtocolV2TargetStatus = (method as any).assertProtocolV2TargetStatus.bind(method);
6038
- const expectedTargetIds = new Set([3, 4]);
6039
- const expectedPaths = new Map([
6040
- [3, 'vol0:/bootloader.bin'],
6041
- [4, 'vol0:/application_p1.bin'],
6042
- ]);
6043
- const liveTargetIds = new Set([4]);
6044
- method.postProgressMessage = jest.fn();
6045
-
6046
- const completed = assertProtocolV2TargetStatus(
6047
- [
6048
- { target_id: 3, status: 2, path: 'vol0:/bootloader.bin' },
6049
- { target_id: 4, status: 2, path: 'vol0:/application_p1.bin' },
6050
- ],
6051
- expectedTargetIds,
6052
- expectedPaths,
6053
- liveTargetIds
6054
- );
6055
-
6056
- expect(completed).toBe(false);
6057
- expect((method as any).protocolV2CompletedTargetIds).toEqual(new Set([4]));
6058
- expect(method.postProgressMessage).toHaveBeenCalledWith(50, 'installingFirmware');
6059
- expect(method.postProgressMessage).not.toHaveBeenCalledWith(100, 'installingFirmware');
6060
- });
6061
-
6062
5633
  test('ignores stale failed records until the current install starts', async () => {
6063
5634
  const method = new FirmwareUpdateV4({
6064
5635
  id: 1,
@@ -6107,141 +5678,6 @@ describe('Protocol V2 firmware update targets', () => {
6107
5678
  expect(typedCall).toHaveBeenCalledTimes(3);
6108
5679
  });
6109
5680
 
6110
- test('ignores leftover failed records while another leftover target is still pending', async () => {
6111
- const method = new FirmwareUpdateV4({
6112
- id: 1,
6113
- payload: {
6114
- method: 'firmwareUpdateV4',
6115
- },
6116
- });
6117
- const typedCall = jest
6118
- .fn()
6119
- .mockResolvedValueOnce({
6120
- type: 'DeviceFirmwareUpdateStatus',
6121
- message: {
6122
- records: [
6123
- { target_id: 3, status: 0, path: 'vol0:/bootloader.bin' },
6124
- { target_id: 4, status: 3, path: 'vol0:/application_p1.bin' },
6125
- ],
6126
- },
6127
- })
6128
- .mockResolvedValueOnce({
6129
- type: 'DeviceFirmwareUpdateStatus',
6130
- message: {
6131
- records: [
6132
- { target_id: 3, status: 0, path: 'vol0:/bootloader.bin' },
6133
- { target_id: 4, status: 0, path: 'vol0:/application_p1.bin' },
6134
- ],
6135
- },
6136
- })
6137
- .mockResolvedValueOnce({
6138
- type: 'DeviceFirmwareUpdateStatus',
6139
- message: {
6140
- records: [
6141
- { target_id: 3, status: 2, path: 'vol0:/bootloader.bin' },
6142
- { target_id: 4, status: 2, path: 'vol0:/application_p1.bin' },
6143
- ],
6144
- },
6145
- });
6146
- const setTimeoutSpy = jest.spyOn(global, 'setTimeout').mockImplementation(((
6147
- callback: () => void
6148
- ) => {
6149
- callback();
6150
- return 0 as any;
6151
- }) as typeof setTimeout);
6152
-
6153
- (method as any).device = stubDevice({
6154
- getCommands: () => ({ typedCall }),
6155
- });
6156
- (method as any).reconnectProtocolV2Device = jest.fn().mockResolvedValue(undefined);
6157
- (method as any).verifyProtocolV2ReconnectIdentity = jest.fn().mockResolvedValue(undefined);
6158
- method.postProgressMessage = jest.fn();
6159
-
6160
- try {
6161
- await (method as any).waitForProtocolV2FirmwareUpdateComplete(
6162
- [
6163
- { target_id: 3, path: 'vol0:/bootloader.bin' },
6164
- { target_id: 4, path: 'vol0:/application_p1.bin' },
6165
- ],
6166
- true
6167
- );
6168
- } finally {
6169
- setTimeoutSpy.mockRestore();
6170
- }
6171
-
6172
- expect(typedCall).toHaveBeenCalledTimes(3);
6173
- expect(method.postProgressMessage).toHaveBeenCalledWith(100, 'installingFirmware');
6174
- });
6175
-
6176
- test('reports failed only after that target was live in the current install', async () => {
6177
- const method = new FirmwareUpdateV4({
6178
- id: 1,
6179
- payload: {
6180
- method: 'firmwareUpdateV4',
6181
- },
6182
- });
6183
- const typedCall = jest
6184
- .fn()
6185
- .mockResolvedValueOnce({
6186
- type: 'DeviceFirmwareUpdateStatus',
6187
- message: {
6188
- records: [
6189
- { target_id: 3, status: 0, path: 'vol0:/bootloader.bin' },
6190
- { target_id: 4, status: 3, path: 'vol0:/application_p1.bin' },
6191
- ],
6192
- },
6193
- })
6194
- .mockResolvedValueOnce({
6195
- type: 'DeviceFirmwareUpdateStatus',
6196
- message: {
6197
- records: [
6198
- { target_id: 3, status: 0, path: 'vol0:/bootloader.bin' },
6199
- { target_id: 4, status: 0, path: 'vol0:/application_p1.bin' },
6200
- ],
6201
- },
6202
- })
6203
- .mockResolvedValueOnce({
6204
- type: 'DeviceFirmwareUpdateStatus',
6205
- message: {
6206
- records: [
6207
- { target_id: 3, status: 0, path: 'vol0:/bootloader.bin' },
6208
- { target_id: 4, status: 3, path: 'vol0:/application_p1.bin' },
6209
- ],
6210
- },
6211
- });
6212
- const setTimeoutSpy = jest.spyOn(global, 'setTimeout').mockImplementation(((
6213
- callback: () => void
6214
- ) => {
6215
- callback();
6216
- return 0 as any;
6217
- }) as typeof setTimeout);
6218
-
6219
- (method as any).device = stubDevice({
6220
- getCommands: () => ({ typedCall }),
6221
- });
6222
- (method as any).reconnectProtocolV2Device = jest.fn().mockResolvedValue(undefined);
6223
- (method as any).verifyProtocolV2ReconnectIdentity = jest.fn().mockResolvedValue(undefined);
6224
-
6225
- try {
6226
- await expect(
6227
- (method as any).waitForProtocolV2FirmwareUpdateComplete(
6228
- [
6229
- { target_id: 3, path: 'vol0:/bootloader.bin' },
6230
- { target_id: 4, path: 'vol0:/application_p1.bin' },
6231
- ],
6232
- true
6233
- )
6234
- ).rejects.toMatchObject({
6235
- errorCode: HardwareErrorCode.FirmwareError,
6236
- message: 'Protocol V2 firmware install failed',
6237
- });
6238
- } finally {
6239
- setTimeoutSpy.mockRestore();
6240
- }
6241
-
6242
- expect(typedCall).toHaveBeenCalledTimes(3);
6243
- });
6244
-
6245
5681
  test('waits five minutes before rejecting normal mode without install evidence', async () => {
6246
5682
  const method = new FirmwareUpdateV4({
6247
5683
  id: 1,
@@ -6348,6 +5784,7 @@ describe('Protocol V2 firmware update targets', () => {
6348
5784
  });
6349
5785
  const typedCall = jest
6350
5786
  .fn()
5787
+ .mockResolvedValueOnce({ type: 'Success', message: {} })
6351
5788
  .mockRejectedValueOnce(new Error('Pro2 is rebooting'))
6352
5789
  .mockResolvedValueOnce({
6353
5790
  type: 'DeviceFirmwareUpdateStatus',
@@ -6364,7 +5801,6 @@ describe('Protocol V2 firmware update targets', () => {
6364
5801
  (method as any).device = stubDevice({
6365
5802
  getCommands: () => ({ typedCall }),
6366
5803
  });
6367
- (method as any).protocolV2InstallTerminalSuccessObserved = true;
6368
5804
  (method as any).reconnectProtocolV2Device = jest.fn().mockResolvedValue(undefined);
6369
5805
  (method as any).verifyProtocolV2ReconnectIdentity = jest.fn().mockResolvedValue(deviceInfo);
6370
5806
  (method as any).probeProtocolV2NormalMode = jest.fn().mockResolvedValue(true);
@@ -6385,54 +5821,6 @@ describe('Protocol V2 firmware update targets', () => {
6385
5821
  expect(method.postProgressMessage).toHaveBeenCalledWith(100, 'installingFirmware');
6386
5822
  });
6387
5823
 
6388
- test('uses the confirmed install request as evidence after the same device returns', async () => {
6389
- const method = new FirmwareUpdateV4({
6390
- id: 1,
6391
- payload: {
6392
- method: 'firmwareUpdateV4',
6393
- },
6394
- });
6395
- const typedCall = jest
6396
- .fn()
6397
- .mockRejectedValueOnce(new Error('The USB device was disconnected'))
6398
- .mockResolvedValueOnce({
6399
- type: 'DeviceFirmwareUpdateStatus',
6400
- message: { records: [] },
6401
- });
6402
- const deviceInfo = { hw: { serial_no: 'PRO2-PHYSICAL-1' } };
6403
- const setTimeoutSpy = jest.spyOn(global, 'setTimeout').mockImplementation(((
6404
- callback: () => void
6405
- ) => {
6406
- callback();
6407
- return 0 as any;
6408
- }) as typeof setTimeout);
6409
-
6410
- (method as any).device = stubDevice({
6411
- getCommands: () => ({ typedCall }),
6412
- });
6413
- (method as any).protocolV2InstallTerminalSuccessObserved = true;
6414
- (method as any).reconnectProtocolV2Device = jest.fn().mockResolvedValue(undefined);
6415
- (method as any).verifyProtocolV2ReconnectIdentity = jest.fn().mockResolvedValue(deviceInfo);
6416
- (method as any).probeProtocolV2NormalMode = jest.fn().mockResolvedValue(true);
6417
- method.postProgressMessage = jest.fn();
6418
-
6419
- try {
6420
- await expect(
6421
- (method as any).waitForProtocolV2FirmwareUpdateComplete(
6422
- [{ target_id: 4, path: 'vol0:/application_p1.bin' }],
6423
- true
6424
- )
6425
- ).resolves.toBeUndefined();
6426
- } finally {
6427
- setTimeoutSpy.mockRestore();
6428
- }
6429
-
6430
- expect((method as any).reconnectProtocolV2Device).toHaveBeenCalledWith({
6431
- skipProtocolProbe: true,
6432
- });
6433
- expect(method.postProgressMessage).toHaveBeenLastCalledWith(100, 'installingFirmware');
6434
- });
6435
-
6436
5824
  test.each([
6437
5825
  [{ mode: 'normal', bootloaderMode: false }, true],
6438
5826
  [{ mode: 'notInitialized', bootloaderMode: false }, true],
@@ -6795,7 +6183,7 @@ describe('Protocol V2 firmware update targets', () => {
6795
6183
  expect(reconnectProtocolV2Device).not.toHaveBeenCalled();
6796
6184
  expect(typedCall).toHaveBeenCalledWith(
6797
6185
  'DeviceFirmwareUpdateStatusGet',
6798
- 'DeviceFirmwareUpdateStatus',
6186
+ ['DeviceFirmwareUpdateStatus', 'Success'],
6799
6187
  expect.anything(),
6800
6188
  expect.anything()
6801
6189
  );
@@ -7077,12 +6465,10 @@ describe('Protocol V2 firmware update targets', () => {
7077
6465
  });
7078
6466
  expect(typedCall).toHaveBeenCalledWith(
7079
6467
  'DeviceFirmwareUpdateStatusGet',
7080
- 'DeviceFirmwareUpdateStatus',
6468
+ ['DeviceFirmwareUpdateStatus', 'Success'],
7081
6469
  {
7082
6470
  fields: {
7083
6471
  status: true,
7084
- progress_percent: true,
7085
- phase_info: true,
7086
6472
  payload_version: true,
7087
6473
  path: true,
7088
6474
  },
@@ -8797,36 +8183,6 @@ describe('Protocol V2 firmware update targets', () => {
8797
8183
  });
8798
8184
  });
8799
8185
 
8800
- test('does not retry or wrap a stale BLE bond during a V4 file transfer', async () => {
8801
- const method = new FirmwareUpdateV4({
8802
- id: 1,
8803
- payload: {
8804
- method: 'firmwareUpdateV4',
8805
- },
8806
- });
8807
- const staleBondError = ERRORS.TypedError(HardwareErrorCode.BlePeerRemovedPairingInformation);
8808
- (method as any).fileWriteChunk = jest.fn().mockRejectedValue(staleBondError);
8809
- const recoverProtocolV2FileTransfer = jest.fn();
8810
- (method as any).recoverProtocolV2FileTransfer = recoverProtocolV2FileTransfer;
8811
- const source = await openFirmwareByteSource({
8812
- binary: new Uint8Array([1]).buffer,
8813
- });
8814
-
8815
- try {
8816
- await expect(
8817
- (method as any).protocolV2SourceUpdateProcess({
8818
- source,
8819
- filePath: 'vol1:firmware.bin',
8820
- processedSize: 0,
8821
- totalSize: 1,
8822
- })
8823
- ).rejects.toBe(staleBondError);
8824
- } finally {
8825
- await source?.close();
8826
- }
8827
- expect(recoverProtocolV2FileTransfer).not.toHaveBeenCalled();
8828
- });
8829
-
8830
8186
  test('throttles repeated transfer progress while preserving file completion', async () => {
8831
8187
  const method = new FirmwareUpdateV4({
8832
8188
  id: 1,
@@ -9333,28 +8689,26 @@ describe('Protocol V2 firmware update targets', () => {
9333
8689
  expect(writePayloads.map(payload => payload.file.data.byteLength)).toEqual([1960, 1]);
9334
8690
  });
9335
8691
 
9336
- test('keeps confirmation active after the Request write until terminal Success arrives', async () => {
8692
+ test('keeps the confirmation UI active after Stage and the empty Request are written', async () => {
9337
8693
  const method = new FirmwareUpdateV4({
9338
8694
  id: 1,
9339
8695
  payload: {
9340
8696
  method: 'firmwareUpdateV4',
9341
8697
  },
9342
8698
  });
9343
- let onResponseAfterWrite:
9344
- | ((response: { type: string; message: Record<string, never> }) => void)
9345
- | undefined;
8699
+ let resolveWrite: ((value: unknown) => void) | undefined;
9346
8700
  const typedCall = jest.fn().mockResolvedValue({ type: 'Success', message: {} });
9347
- const call = jest.fn().mockImplementation((_type, _message, options) => {
9348
- onResponseAfterWrite = options.onResponseAfterWrite;
9349
- return Promise.resolve({ type: 'WriteCompleted', message: {} });
9350
- });
9351
- const clearCancelableAction = jest.fn();
8701
+ const call = jest.fn().mockImplementation(
8702
+ () =>
8703
+ new Promise(resolve => {
8704
+ resolveWrite = resolve;
8705
+ })
8706
+ );
9352
8707
 
9353
8708
  (method as any).device = stubDevice({
9354
- getCommands: () => ({ typedCall, call, cancelDevice: jest.fn() }),
8709
+ getCommands: () => ({ typedCall, call }),
9355
8710
  createProtocolV2UiPhaseMetadata: jest.fn().mockReturnValue(undefined),
9356
8711
  toMessageObject: jest.fn().mockReturnValue({ connectId: 'pro2' }),
9357
- clearCancelableAction,
9358
8712
  });
9359
8713
  method.postMessage = jest.fn();
9360
8714
  method.postProgressMessage = jest.fn();
@@ -9375,25 +8729,18 @@ describe('Protocol V2 firmware update targets', () => {
9375
8729
  expect(call).toHaveBeenCalledWith(
9376
8730
  'DeviceFirmwareUpdateRequest',
9377
8731
  {},
9378
- expect.objectContaining({
9379
- returnAfterWrite: true,
9380
- expectedTypes: ['Success'],
9381
- onResponseAfterWrite: expect.any(Function),
9382
- })
8732
+ { returnAfterWrite: true }
9383
8733
  );
9384
8734
  expect(method.postTipMessage).not.toHaveBeenCalled();
9385
8735
  expect(method.postProgressMessage).not.toHaveBeenCalled();
9386
- expect(clearCancelableAction).not.toHaveBeenCalled();
9387
8736
 
8737
+ resolveWrite?.({ type: 'WriteCompleted', message: {} });
9388
8738
  await startPromise;
9389
- onResponseAfterWrite?.({ type: 'Success', message: {} });
9390
- expect(clearCancelableAction).toHaveBeenCalledTimes(1);
9391
- expect((method as any).protocolV2InstallTerminalSuccessObserved).toBe(true);
9392
8739
  expect(method.postTipMessage).not.toHaveBeenCalled();
9393
8740
  expect(method.postProgressMessage).not.toHaveBeenCalled();
9394
8741
  });
9395
8742
 
9396
- test('returns after the empty Protocol V2 firmware install request is written', async () => {
8743
+ test('sends an empty Protocol V2 firmware install request without waiting for its response', async () => {
9397
8744
  const method = new FirmwareUpdateV4({
9398
8745
  id: 1,
9399
8746
  payload: {
@@ -9404,13 +8751,10 @@ describe('Protocol V2 firmware update targets', () => {
9404
8751
  type: 'Success',
9405
8752
  message: { message: 'accepted' },
9406
8753
  });
9407
- const call = jest.fn().mockResolvedValue({
9408
- type: 'WriteCompleted',
9409
- message: {},
9410
- });
8754
+ const call = jest.fn().mockResolvedValue({ type: 'WriteCompleted', message: {} });
9411
8755
 
9412
8756
  (method as any).device = stubDevice({
9413
- getCommands: () => ({ typedCall, call, cancelDevice: jest.fn() }),
8757
+ getCommands: () => ({ typedCall, call }),
9414
8758
  createProtocolV2UiPhaseMetadata: jest.fn().mockReturnValue(undefined),
9415
8759
  toMessageObject: jest.fn().mockReturnValue({ connectId: 'pro2' }),
9416
8760
  });
@@ -9426,14 +8770,9 @@ describe('Protocol V2 firmware update targets', () => {
9426
8770
  expect(call).toHaveBeenCalledWith(
9427
8771
  'DeviceFirmwareUpdateRequest',
9428
8772
  {},
9429
- expect.objectContaining({
9430
- returnAfterWrite: true,
9431
- expectedTypes: ['Success'],
9432
- onResponseAfterWrite: expect.any(Function),
9433
- })
8773
+ { returnAfterWrite: true }
9434
8774
  );
9435
8775
  expect(method.postTipMessage).not.toHaveBeenCalled();
9436
- expect(method.postProgressMessage).not.toHaveBeenCalled();
9437
8776
  });
9438
8777
  });
9439
8778
 
@@ -9616,16 +8955,7 @@ describe('Protocol V2 firmware update method', () => {
9616
8955
  test('passes firmware update status fields through to Protocol V2', async () => {
9617
8956
  const typedCall = jest.fn().mockResolvedValue({
9618
8957
  message: {
9619
- records: [
9620
- {
9621
- target_id: 4,
9622
- status: 1,
9623
- progress_percent: 42,
9624
- phase_info: { phase: 1, progress_percent: 60 },
9625
- payload_version: 1,
9626
- path: 'vol1:application_p1.bin',
9627
- },
9628
- ],
8958
+ records: [{ target_id: 4, status: 2, payload_version: 1, path: 'vol1:application_p1.bin' }],
9629
8959
  },
9630
8960
  });
9631
8961
  const method = new DeviceGetFirmwareUpdateStatus({
@@ -9634,8 +8964,6 @@ describe('Protocol V2 firmware update method', () => {
9634
8964
  method: 'deviceGetFirmwareUpdateStatus',
9635
8965
  fields: {
9636
8966
  status: true,
9637
- progress_percent: true,
9638
- phase_info: true,
9639
8967
  payload_version: true,
9640
8968
  path: true,
9641
8969
  },
@@ -9647,16 +8975,7 @@ describe('Protocol V2 firmware update method', () => {
9647
8975
  });
9648
8976
 
9649
8977
  await expect(method.run()).resolves.toEqual({
9650
- records: [
9651
- {
9652
- target_id: 4,
9653
- status: 1,
9654
- progress_percent: 42,
9655
- phase_info: { phase: 1, progress_percent: 60 },
9656
- payload_version: 1,
9657
- path: 'vol1:application_p1.bin',
9658
- },
9659
- ],
8978
+ records: [{ target_id: 4, status: 2, payload_version: 1, path: 'vol1:application_p1.bin' }],
9660
8979
  });
9661
8980
  expect(typedCall).toHaveBeenCalledWith(
9662
8981
  'DeviceFirmwareUpdateStatusGet',
@@ -9664,8 +8983,6 @@ describe('Protocol V2 firmware update method', () => {
9664
8983
  {
9665
8984
  fields: {
9666
8985
  status: true,
9667
- progress_percent: true,
9668
- phase_info: true,
9669
8986
  payload_version: true,
9670
8987
  path: true,
9671
8988
  },