File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -294,3 +294,33 @@ test('uses zod default values for initial values', async () => {
294294 } )
295295 ) ;
296296} ) ;
297+
298+ // #4186
299+ test ( 'default values should not be undefined' , async ( ) => {
300+ const initialSpy = jest . fn ( ) ;
301+ mountWithHoc ( {
302+ setup ( ) {
303+ const schema = toTypedSchema (
304+ zod . object ( {
305+ email : zod . string ( ) . min ( 1 ) ,
306+ } )
307+ ) ;
308+
309+ const { values } = useForm ( {
310+ validationSchema : schema ,
311+ } ) ;
312+
313+ // submit now
314+ initialSpy ( values ) ;
315+
316+ return {
317+ schema,
318+ } ;
319+ } ,
320+ template : `<div></div>` ,
321+ } ) ;
322+
323+ await flushPromises ( ) ;
324+ await expect ( initialSpy ) . toHaveBeenCalledTimes ( 1 ) ;
325+ await expect ( initialSpy ) . toHaveBeenLastCalledWith ( expect . objectContaining ( { } ) ) ;
326+ } ) ;
You can’t perform that action at this time.
0 commit comments