Skip to content

Commit 40604c2

Browse files
committed
Add unit test
1 parent 127a80f commit 40604c2

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

packages/transaction-controller/src/helpers/IncomingTransactionHelper.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,31 @@ describe('IncomingTransactionHelper', () => {
376376

377377
expect(jest.getTimerCount()).toBe(0);
378378
});
379+
380+
it('does not queue additional updates if first is still running', async () => {
381+
const remoteTransactionSource = createRemoteTransactionSourceMock([]);
382+
383+
const helper = new IncomingTransactionHelper({
384+
...CONTROLLER_ARGS_MOCK,
385+
remoteTransactionSource,
386+
});
387+
388+
helper.start();
389+
helper.stop();
390+
391+
helper.start();
392+
helper.stop();
393+
394+
helper.start();
395+
396+
await flushPromises();
397+
398+
expect(jest.getTimerCount()).toBe(1);
399+
400+
expect(remoteTransactionSource.fetchTransactions).toHaveBeenCalledTimes(
401+
1,
402+
);
403+
});
379404
});
380405

381406
describe('stop', () => {

0 commit comments

Comments
 (0)