@@ -3,7 +3,6 @@ import { act, renderHook, waitFor } from "@testing-library/react";
3
3
4
4
import { selectieLijstKlasseFactory as mockSelectieLijstKlasseFactory } from "../fixtures/selectieLijstKlasseChoices" ;
5
5
import * as fieldSelection from "../lib/fieldSelection/fieldSelection" ;
6
- import { Zaak } from "../types" ;
7
6
import { useFields } from "./useFields" ;
8
7
9
8
jest . mock ( "./useSelectielijstKlasseChoices" , ( ) => ( {
@@ -91,12 +90,12 @@ describe("useFields Hook", () => {
91
90
it ( "should apply filter transformations correctly" , async ( ) => {
92
91
const { result } = renderHook ( ( ) => useFields ( ) ) ;
93
92
94
- waitFor ( ( ) => {
93
+ await waitFor ( async ( ) => {
95
94
const [ , , filterTransform ] = result . current ;
96
95
97
96
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") ] ,
100
99
} ;
101
100
102
101
const transformedData = filterTransform ( filterData ) ;
@@ -110,11 +109,13 @@ describe("useFields Hook", () => {
110
109
} ) ;
111
110
112
111
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
+
114
114
const [ fields ] = result . current ;
115
115
const selectielijstKlasse = fields . find (
116
116
( f ) => f . name === "selectielijstklasse" ,
117
117
) ;
118
+
118
119
expect ( selectielijstKlasse ?. options ?. length ) . toBeTruthy ( ) ;
119
120
expect ( selectielijstKlasse ?. options ?. [ 0 ] . value ) . toContain ( "https://" ) ;
120
121
} ) ;
0 commit comments