@@ -13,25 +13,23 @@ type ModeTest = {
1313} ;
1414
1515describe ( 'Strict mode' , ( ) => {
16- /*
1716 test ( 'Should remove keys not part of the schema' , async ( ) => {
1817 const input = { fooo : 'wrong-key' , foo : 'correct-key' } ;
18+
1919 const schema = z . object ( {
2020 foo : z . string ( )
2121 } ) ;
2222
2323 const form = await superValidate ( input as Record < string , unknown > , zod ( schema ) , {
2424 strict : true
2525 } ) ;
26- expect(input).toMatchObject({ fooo: 'wrong-key', foo: 'correct-key' });
26+
2727 expect ( form . data ) . toEqual ( { foo : 'correct-key' } ) ;
2828 expect ( form . errors ) . toEqual ( { } ) ;
2929 expect ( form . valid ) . toEqual ( true ) ;
3030 } ) ;
31- */
3231
3332 const strictTests = [
34- /*
3533 {
3634 name : 'Should be invalid if foo is not present in object' ,
3735 schema : z . object ( {
@@ -66,7 +64,6 @@ describe('Strict mode', () => {
6664 valid : true ,
6765 errors : { }
6866 } ,
69- */
7067 {
7168 name : 'Should be invalid if key is mispelled' ,
7269 schema : z . object ( {
@@ -82,8 +79,7 @@ describe('Strict mode', () => {
8279 errors : {
8380 foo : [ 'Required' ]
8481 }
85- }
86- /*
82+ } ,
8783 {
8884 name : 'Should work with number' ,
8985 schema : z . object ( {
@@ -142,13 +138,11 @@ describe('Strict mode', () => {
142138 foo : [ 'Required' ]
143139 }
144140 }
145- */
146141 ] ;
147142
148143 testMode ( strictTests , true ) ;
149144} ) ;
150145
151- /*
152146describe ( 'Non-strict mode' , ( ) => {
153147 test ( 'Should remove keys not part of the schema' , async ( ) => {
154148 const input = { fooo : 'wrong-key' , foo : 'correct-key' } ;
@@ -258,7 +252,6 @@ describe('Non-strict mode', () => {
258252
259253 testMode ( nonStrictTests , false ) ;
260254} ) ;
261- */
262255
263256function testMode ( tests : ModeTest [ ] , strict : boolean ) {
264257 for ( const { name, input, schema, valid, expected, errors } of tests ) {
0 commit comments