Skip to content

Commit

Permalink
test(connect): disable autoconfirm in override test
Browse files Browse the repository at this point in the history
  • Loading branch information
marekrjpolak committed Jan 2, 2025
1 parent 0ad8dc0 commit c2b1839
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions packages/connect/e2e/common.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,12 @@ export const setup = async (
);
};

type InitParams = Partial<Parameters<typeof TrezorConnect.init>[0]> & { autoConfirm?: boolean };

export const initTrezorConnect = async (
// eslint-disable-next-line @typescript-eslint/no-shadow
TrezorUserEnvLink: TrezorUserEnvLinkClass,
options?: Partial<Parameters<typeof TrezorConnect.init>[0]>,
{ autoConfirm = true, ...options }: InitParams = {},
) => {
TrezorConnect.removeAllListeners();

Expand Down Expand Up @@ -162,9 +164,11 @@ export const initTrezorConnect = async (
});
});

TrezorConnect.on(UI.REQUEST_BUTTON, () => {
setTimeout(() => TrezorUserEnvLink.send({ type: 'emulator-press-yes' }), 1);
});
if (autoConfirm) {
TrezorConnect.on(UI.REQUEST_BUTTON, () => {
setTimeout(() => TrezorUserEnvLink.send({ type: 'emulator-press-yes' }), 1);
});
}

await TrezorConnect.init({
manifest: {
Expand Down
2 changes: 1 addition & 1 deletion packages/connect/e2e/tests/device/override.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('TrezorConnect override param', () => {
await setup(controller, {
mnemonic: 'mnemonic_all',
});
await initTrezorConnect(controller);
await initTrezorConnect(controller, { autoConfirm: false });
});

afterAll(() => {
Expand Down

0 comments on commit c2b1839

Please sign in to comment.