diff --git a/packages/transport/src/sessions/background.ts b/packages/transport/src/sessions/background.ts index 0f386e8a60f..3951b154971 100644 --- a/packages/transport/src/sessions/background.ts +++ b/packages/transport/src/sessions/background.ts @@ -51,7 +51,6 @@ export class SessionsBackground extends TypedEmitter<{ constructor({ signal }: { signal: AbortSignal }) { super(); signal.addEventListener('abort', () => { - console.log('background aborted!!!'); this.locksQueue.forEach(lock => clearTimeout(lock.id)); }); } diff --git a/packages/transport/tests/abstractUsb.test.ts b/packages/transport/tests/abstractUsb.test.ts index cfc17befe5a..de51445d0f9 100644 --- a/packages/transport/tests/abstractUsb.test.ts +++ b/packages/transport/tests/abstractUsb.test.ts @@ -59,11 +59,14 @@ class TestUsbTransport extends AbstractApiTransport { } // we cant directly use abstract class (UsbTransport) const initTest = async () => { + let abortController = new AbortController(); + let sessionsBackground: SessionsBackground; let sessionsClient: SessionsClient; let transport: AbstractTransport; let testUsbApi: UsbApi; - let abortController = new AbortController(); + + sessionsBackground = new SessionsBackground({ signal: abortController.signal }); sessionsClient = new SessionsClient({ requestFn: params => sessionsBackground.handleMessage(params), @@ -74,8 +77,6 @@ const initTest = async () => { }, }); - sessionsBackground = new SessionsBackground({ signal: abortController.signal }); - sessionsBackground.on('descriptors', descriptors => { sessionsClient.emit('descriptors', descriptors); }); @@ -139,7 +140,7 @@ describe('Usb', () => { }); }); - it.only('enumerate error', async () => { + it('enumerate error', async () => { const abortController = new AbortController(); const sessionsBackground = new SessionsBackground({ signal: abortController.signal }); @@ -245,9 +246,9 @@ describe('Usb', () => { jest.runAllTimers(); - expect( - transport.acquire({ input: { path: '123', previous: null } }).promise, - ).resolves.toEqual({ + const result = await transport.acquire({ input: { path: '123', previous: null } }) + .promise; + expect(result).toEqual({ success: true, payload: '1', }); @@ -476,7 +477,7 @@ describe('Usb', () => { session: acquireRes.payload, protocol: v1Protocol, }); - // await promise2; + await promise2; expect(promise2).resolves.toEqual({ success: true, payload: {