consistent use of fakeTimers

This commit is contained in:
Min RK
2024-08-29 14:44:16 +02:00
parent 992bc98ff1
commit 6ccb809a2a
7 changed files with 19 additions and 15 deletions

View File

@@ -57,6 +57,7 @@ beforeEach(() => {
afterEach(() => {
useSelector.mockClear();
jest.runAllTimers();
});
test("Renders", async () => {
@@ -81,8 +82,10 @@ test("Adds user from input to user selectables on button click", async () => {
let submit = screen.getByTestId("submit");
const user = userEvent.setup({ advanceTimers: jest.advanceTimersByTime });
await user.type(input, "bar");
await fireEvent.click(validateUser);
await act(async () => okPacket);
await user.click(validateUser);
await act(async () => {
await jest.runAllTimers();
});
await act(async () => {
await fireEvent.click(submit);