File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -233,7 +233,7 @@ describe('create-task-dto', () => {
233233
234234 it ( 'should allow extra fields like createdAt and updatedAt' , ( ) => {
235235 // Arrange
236- const validDto = {
236+ const invalidDto = {
237237 title : 'Test Task' ,
238238 isComplete : false ,
239239 createdAt : '2025-01-01T10:00:00.000Z' ,
@@ -242,14 +242,17 @@ describe('create-task-dto', () => {
242242 } ;
243243
244244 // Act
245- const result = CreateTaskDtoSchema . safeParse ( validDto ) ;
245+ const result = CreateTaskDtoSchema . safeParse ( invalidDto ) ;
246246
247247 // Assert
248248 expect ( result . success ) . toBe ( true ) ;
249249 if ( result . success ) {
250250 // Validated DTO only contains the fields we defined in the schema
251251 expect ( result . data . title ) . toBe ( 'Test Task' ) ;
252252 expect ( result . data . isComplete ) . toBe ( false ) ;
253+ expect ( result . data ) . not . toHaveProperty ( 'createdAt' ) ;
254+ expect ( result . data ) . not . toHaveProperty ( 'updatedAt' ) ;
255+ expect ( result . data ) . not . toHaveProperty ( 'id' ) ;
253256 }
254257 } ) ;
255258 } ) ;
You can’t perform that action at this time.
0 commit comments