File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
apps/web/src/utils/__tests__ Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -37,12 +37,16 @@ describe('Zod3', () => {
3737 const result = Zod3 . getZodTypeName ( z3 . array ( z3 . object ( { age : z3 . number ( ) , name : z3 . string ( ) } ) ) ) ;
3838 expect ( result ) . toMatchObject ( {
3939 isOptional : false ,
40- multiKeys : [ 'name' , 'age' ] ,
4140 typeName : 'ZodArray'
4241 } ) ;
42+ expect ( result . multiKeys ) . toHaveLength ( 2 ) ;
43+ expect ( result . multiKeys ) . toEqual ( expect . arrayContaining ( [ 'name' , 'age' ] ) ) ;
4344 expect ( result . multiValues ) . toHaveLength ( 2 ) ;
44- expect ( result . multiValues ?. [ 0 ] ) . toMatchObject ( { typeName : 'ZodString' } ) ;
45- expect ( result . multiValues ?. [ 1 ] ) . toMatchObject ( { typeName : 'ZodNumber' } ) ;
45+ // Find the index of each key to check the corresponding value
46+ const nameIndex = result . multiKeys ?. indexOf ( 'name' ) ?? - 1 ;
47+ const ageIndex = result . multiKeys ?. indexOf ( 'age' ) ?? - 1 ;
48+ expect ( result . multiValues ?. [ nameIndex ] ) . toMatchObject ( { typeName : 'ZodString' } ) ;
49+ expect ( result . multiValues ?. [ ageIndex ] ) . toMatchObject ( { typeName : 'ZodNumber' } ) ;
4650 } ) ;
4751
4852 it ( 'should parse set type' , ( ) => {
You can’t perform that action at this time.
0 commit comments