@@ -4,10 +4,12 @@ import { schema, validData, invalidData, fields } from './__fixtures__/data';
44const shouldUseNativeValidation = false ;
55
66describe ( 'zodResolver' , ( ) => {
7- it ( 'should return values from zodResolver when validation pass' , async ( ) => {
7+ it ( 'should return values from zodResolver when validation pass & rawValues=true ' , async ( ) => {
88 const parseAsyncSpy = jest . spyOn ( schema , 'parseAsync' ) ;
99
10- const result = await zodResolver ( schema ) ( validData , undefined , {
10+ const result = await zodResolver ( schema , undefined , {
11+ rawValues : true ,
12+ } ) ( validData , undefined , {
1113 fields,
1214 shouldUseNativeValidation,
1315 } ) ;
@@ -16,7 +18,7 @@ describe('zodResolver', () => {
1618 expect ( result ) . toEqual ( { errors : { } , values : validData } ) ;
1719 } ) ;
1820
19- it ( 'should return values from zodResolver with `mode: sync` when validation pass' , async ( ) => {
21+ it ( 'should return parsed values from zodResolver with `mode: sync` when validation pass' , async ( ) => {
2022 const parseSpy = jest . spyOn ( schema , 'parse' ) ;
2123 const parseAsyncSpy = jest . spyOn ( schema , 'parseAsync' ) ;
2224
@@ -26,7 +28,8 @@ describe('zodResolver', () => {
2628
2729 expect ( parseSpy ) . toHaveBeenCalledTimes ( 1 ) ;
2830 expect ( parseAsyncSpy ) . not . toHaveBeenCalled ( ) ;
29- expect ( result ) . toEqual ( { errors : { } , values : validData } ) ;
31+ expect ( result . errors ) . toEqual ( { } ) ;
32+ expect ( result ) . toMatchSnapshot ( ) ;
3033 } ) ;
3134
3235 it ( 'should return a single error from zodResolver when validation fails' , async ( ) => {
0 commit comments