Skip to content

Commit 5662edb

Browse files
✅ - test: fix the frontend tests
1 parent ee235eb commit 5662edb

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

frontend/src/hooks/useFields.test.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { act, renderHook, waitFor } from "@testing-library/react";
33

44
import { selectieLijstKlasseFactory as mockSelectieLijstKlasseFactory } from "../fixtures/selectieLijstKlasseChoices";
55
import * as fieldSelection from "../lib/fieldSelection/fieldSelection";
6-
import { Zaak } from "../types";
76
import { useFields } from "./useFields";
87

98
jest.mock("./useSelectielijstKlasseChoices", () => ({
@@ -91,12 +90,12 @@ describe("useFields Hook", () => {
9190
it("should apply filter transformations correctly", async () => {
9291
const { result } = renderHook(() => useFields());
9392

94-
waitFor(() => {
93+
await waitFor(async () => {
9594
const [, , filterTransform] = result.current;
9695

9796
const filterData = {
98-
startdatum: "2023-01-01/2023-01-31",
99-
einddatum: "2023-02-01/2023-02-28",
97+
startdatum: [new Date("2023-01-01"), new Date("2023-01-31")],
98+
einddatum: [new Date("2023-02-01"), new Date("2023-02-28")],
10099
};
101100

102101
const transformedData = filterTransform(filterData);
@@ -110,11 +109,13 @@ describe("useFields Hook", () => {
110109
});
111110

112111
it("should provide selectielijst klasse options to selectielijst klasse field", async () => {
113-
const { result } = renderHook(() => useFields());
112+
const { result } = await act(async () => renderHook(() => useFields()));
113+
114114
const [fields] = result.current;
115115
const selectielijstKlasse = fields.find(
116116
(f) => f.name === "selectielijstklasse",
117117
);
118+
118119
expect(selectielijstKlasse?.options?.length).toBeTruthy();
119120
expect(selectielijstKlasse?.options?.[0].value).toContain("https://");
120121
});

0 commit comments

Comments
 (0)