Skip to content

Commit be34f8f

Browse files
committed
Add fake jest timers
1 parent d9f43fa commit be34f8f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/steps/ValidationStep/tests/ValidationStep.test.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ const getFilterSwitch = () =>
2626

2727
const file = new File([""], "file.csv")
2828

29+
jest.useFakeTimers()
30+
2931
describe("Validation step tests", () => {
3032
test("Submit data", async () => {
3133
const onSubmit = jest.fn()
@@ -664,7 +666,7 @@ describe("Validation step tests", () => {
664666
const LASTNAME = "Doe"
665667
const NEW_NAME = "Johnny"
666668
const NEW_LASTNAME = "CENA"
667-
const TIMEOUT = 200
669+
const TIMEOUT = 1000
668670

669671
const fields = [
670672
{
@@ -742,6 +744,9 @@ describe("Validation step tests", () => {
742744
}),
743745
).toBeInTheDocument(),
744746
)
747+
748+
jest.runAllTimers()
749+
745750
// check that the value is updated after the hook runs
746751
await waitFor(() =>
747752
expect(
@@ -762,7 +767,7 @@ describe("Validation step tests", () => {
762767
const LASTNAME = "Doe"
763768
const NEW_NAME = "Johnny"
764769
const NEW_LASTNAME = "CENA"
765-
const TIMEOUT = 200
770+
const TIMEOUT = 1000
766771

767772
const fields = [
768773
{
@@ -839,6 +844,8 @@ describe("Validation step tests", () => {
839844
}),
840845
).toBeInTheDocument(),
841846
)
847+
848+
jest.runAllTimers()
842849
// check that the value is updated after the hook runs
843850
await waitFor(() =>
844851
expect(

0 commit comments

Comments
 (0)