Skip to content

Commit

Permalink
fix: confirm-recovery-phrase unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptotavares committed Oct 2, 2024
1 parent 05364e2 commit 27a0e22
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fireEvent, waitFor } from '@testing-library/react';
import { fireEvent, act } from '@testing-library/react';
import React from 'react';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
Expand Down Expand Up @@ -141,14 +141,16 @@ describe('Confirm Recovery Phrase Component', () => {
'recovery-phrase-confirm',
);

await waitFor(() => {
expect(confirmRecoveryPhraseButton).toBeDisabled();

act(() => {
clock.advanceTimersByTime(500); // Wait for debounce
});

expect(confirmRecoveryPhraseButton).not.toBeDisabled();
expect(confirmRecoveryPhraseButton).not.toBeDisabled();

fireEvent.click(confirmRecoveryPhraseButton);
fireEvent.click(confirmRecoveryPhraseButton);

expect(setSeedPhraseBackedUp).toHaveBeenCalledWith(true);
});
expect(setSeedPhraseBackedUp).toHaveBeenCalledWith(true);
});
});

0 comments on commit 27a0e22

Please sign in to comment.