Skip to content

Commit

Permalink
test(transport): enable skipped unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mroz22 committed May 16, 2024
1 parent 73a4e38 commit 6516c71
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
1 change: 0 additions & 1 deletion packages/transport/src/sessions/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
});
}
Expand Down
17 changes: 9 additions & 8 deletions packages/transport/tests/abstractUsb.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -74,8 +77,6 @@ const initTest = async () => {
},
});

sessionsBackground = new SessionsBackground({ signal: abortController.signal });

sessionsBackground.on('descriptors', descriptors => {
sessionsClient.emit('descriptors', descriptors);
});
Expand Down Expand Up @@ -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 });
Expand Down Expand Up @@ -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',
});
Expand Down Expand Up @@ -476,7 +477,7 @@ describe('Usb', () => {
session: acquireRes.payload,
protocol: v1Protocol,
});
// await promise2;
await promise2;
expect(promise2).resolves.toEqual({
success: true,
payload: {
Expand Down

0 comments on commit 6516c71

Please sign in to comment.