File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -650,6 +650,14 @@ describe('GET /api/streak', () => {
650650 expect ( response . status ) . toBe ( 400 ) ;
651651 expect ( body . details . fieldErrors . date [ 0 ] ) . toContain ( 'Invalid "date" format' ) ;
652652 } ) ;
653+
654+ it ( 'returns 400 when an invalid ISO8601 calendar date format like "2026-15-40" is supplied (Variation 4)' , async ( ) => {
655+ const response = await GET ( makeRequest ( { user : 'octocat' , date : '2026-15-40' } ) ) ;
656+ const body = await response . json ( ) ;
657+
658+ expect ( response . status ) . toBe ( 400 ) ;
659+ expect ( body . details . fieldErrors . date [ 0 ] ) . toContain ( 'Invalid "date" format. Use ISO 8601.' ) ;
660+ } ) ;
653661 } ) ;
654662 } ) ;
655663
Original file line number Diff line number Diff line change @@ -1061,3 +1061,31 @@ describe('streakParamsSchema user maxLength validation boundaries (Variation 3)'
10611061 expect ( parseResult . success ) . toBe ( true ) ;
10621062 } ) ;
10631063} ) ;
1064+
1065+ /* ==========================================================================
1066+ * DATE PARAMETER — QUERY VALIDATION BOUNDARIES (VARIATION 4)
1067+ * ========================================================================== */
1068+
1069+ describe ( 'streakParamsSchema — date query validation boundaries (Variation 4)' , ( ) => {
1070+ it ( 'rejects an invalid date format like "2026-15-40"' , ( ) => {
1071+ const result = streakParamsSchema . safeParse ( {
1072+ user : 'octocat' ,
1073+ date : '2026-15-40' ,
1074+ } ) ;
1075+
1076+ expect ( result . success ) . toBe ( false ) ;
1077+ if ( ! result . success ) {
1078+ const messages = result . error . issues . map ( ( i ) => i . message ) . join ( ' ' ) ;
1079+ expect ( messages ) . toContain ( 'Invalid "date" format. Use ISO 8601.' ) ;
1080+ }
1081+ } ) ;
1082+
1083+ it ( 'accepts a valid ISO8601 date' , ( ) => {
1084+ const result = streakParamsSchema . safeParse ( {
1085+ user : 'octocat' ,
1086+ date : '2026-05-30' ,
1087+ } ) ;
1088+
1089+ expect ( result . success ) . toBe ( true ) ;
1090+ } ) ;
1091+ } ) ;
You can’t perform that action at this time.
0 commit comments