Skip to content

Commit 64673ec

Browse files
committed
[DDW-722] Fix test runner
1 parent 040087d commit 64673ec

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

hardware-wallet-tests/cardano-app-not-started.ts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,16 @@ export const run = () => {
3939
product: expect.any(String),
4040
});
4141

42-
try {
43-
const cardanoAppChannelResponse = await requestLaunchingCardanoAppOnLedger(
44-
params.path
45-
);
42+
const cardanoAppChannelResponse = await requestLaunchingCardanoAppOnLedger(
43+
params.path
44+
);
4645

47-
expect(cardanoAppChannelResponse).toEqual({
48-
minor: expect.any(Number),
49-
major: expect.any(Number),
50-
patch: expect.any(Number),
51-
deviceId: expect.any(String),
52-
});
53-
} catch (err) {
54-
return null;
55-
}
46+
expect(cardanoAppChannelResponse).toEqual({
47+
minor: expect.any(Number),
48+
major: expect.any(Number),
49+
patch: expect.any(Number),
50+
deviceId: expect.any(String),
51+
});
5652

5753
const extendedPublicKey = await publicKeyChannel.request(
5854
{

hardware-wallet-tests/utils.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class MockIpcChannel<Incoming, Outgoing> extends IpcChannel<
5555
}
5656

5757
export const createAndRegisterHardwareWalletChannels = () =>
58-
// @ts-expect-error Argument of type 'ipcRenderer' is not assignable to parameter of type 'BrowserWindow'.
58+
// @ts-ignore Argument of type 'ipcRenderer' is not assignable to parameter of type 'BrowserWindow'.
5959
handleHardwareWalletRequests(ipcRenderer, createChannels(MockIpcChannel));
6060

6161
export const initLedgerChannel = () => {
@@ -78,22 +78,24 @@ export const requestLaunchingCardanoAppOnLedger = (deviceId: string) =>
7878
new Promise((resolve, reject) => {
7979
const cardanoAppChannel = createCardanoAppChannel();
8080

81-
const interval = setInterval(async () => {
81+
const run = async () => {
8282
try {
8383
const cardanoAppChannelResponse = await cardanoAppChannel.request(
8484
{ path: deviceId },
8585
ipcRenderer,
8686
ipcRenderer
8787
);
88-
clearInterval(interval);
8988
return resolve(cardanoAppChannelResponse);
9089
} catch (err) {
9190
if (err.code === DEVICE_NOT_CONNECTED) {
92-
clearInterval(interval);
9391
return reject(err);
9492
}
93+
94+
setTimeout(run, 1000);
9595
}
96-
}, 2000);
96+
};
97+
98+
run();
9799
});
98100

99101
interface Result {

0 commit comments

Comments
 (0)