File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1013,3 +1013,33 @@ describe('streakParamsSchema — layout query validation boundaries (Variation 2
10131013 }
10141014 } ) ;
10151015} ) ;
1016+
1017+ /* ==========================================================================
1018+ * USER PARAMETER — QUERY VALIDATION BOUNDARIES (VARIATION 3)
1019+ * ========================================================================== */
1020+
1021+ describe ( 'streakParamsSchema user maxLength validation boundaries (Variation 3)' , ( ) => {
1022+ it ( 'rejects a GitHub username that exceeds the 39 character length threshold' , ( ) => {
1023+ const invalidPayload = {
1024+ user : 'a' . repeat ( 40 ) ,
1025+ } ;
1026+
1027+ const parseResult = streakParamsSchema . safeParse ( invalidPayload ) ;
1028+
1029+ expect ( parseResult . success ) . toBe ( false ) ;
1030+ if ( ! parseResult . success ) {
1031+ const fieldErrors = parseResult . error . flatten ( ) . fieldErrors ;
1032+ expect ( fieldErrors . user ) . toBeDefined ( ) ;
1033+ expect ( fieldErrors . user ?. [ 0 ] ) . toContain ( 'cannot exceed 39 characters' ) ;
1034+ }
1035+ } ) ;
1036+
1037+ it ( 'accepts a username exactly at the upper limit of 39 characters' , ( ) => {
1038+ const validPayload = {
1039+ user : 'a' . repeat ( 39 ) ,
1040+ } ;
1041+
1042+ const parseResult = streakParamsSchema . safeParse ( validPayload ) ;
1043+ expect ( parseResult . success ) . toBe ( true ) ;
1044+ } ) ;
1045+ } ) ;
You can’t perform that action at this time.
0 commit comments