From 7e6d32516de84dbaed222651e48895dc0136b2e7 Mon Sep 17 00:00:00 2001 From: Pagan Gazzard Date: Mon, 23 Mar 2020 19:02:17 +0000 Subject: [PATCH] Tests: Add missing await Change-type: patch --- test/05-device-state.spec.ts | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/test/05-device-state.spec.ts b/test/05-device-state.spec.ts index 3d0f2d55..3edae59f 100644 --- a/test/05-device-state.spec.ts +++ b/test/05-device-state.spec.ts @@ -288,27 +288,25 @@ describe('deviceState', () => { } }); - it('stores info for pinning a device after loading an apps.json with a pinDevice field', () => { + it('stores info for pinning a device after loading an apps.json with a pinDevice field', async () => { stub(deviceState.applications.images, 'save').returns(Promise.resolve()); stub(deviceState.deviceConfig, 'getCurrent').returns( Promise.resolve(mockedInitialConfig), ); - loadTargetFromFile( + await loadTargetFromFile( process.env.ROOT_MOUNTPOINT + '/apps-pin.json', deviceState, - ).then(() => { - (deviceState as any).applications.images.save.restore(); - (deviceState as any).deviceConfig.getCurrent.restore(); + ); + (deviceState as any).applications.images.save.restore(); + (deviceState as any).deviceConfig.getCurrent.restore(); - config.get('pinDevice').then(pinned => { - expect(pinned) - .to.have.property('app') - .that.equals(1234); - expect(pinned) - .to.have.property('commit') - .that.equals('abcdef'); - }); - }); + const pinned = await config.get('pinDevice'); + expect(pinned) + .to.have.property('app') + .that.equals(1234); + expect(pinned) + .to.have.property('commit') + .that.equals('abcdef'); }); it('emits a change event when a new state is reported', () => {