@@ -53,6 +53,89 @@ describe('githubParamsSchema', () => {
5353} ) ;
5454
5555describe ( 'streakParamsSchema' , ( ) => {
56+ it ( 'accepts a valid width value' , ( ) => {
57+ const result = streakParamsSchema . safeParse ( {
58+ user : 'octocat' ,
59+ width : '400' ,
60+ } ) ;
61+
62+ expect ( result . success ) . toBe ( true ) ;
63+
64+ if ( result . success ) {
65+ expect ( result . data . width ) . toBe ( 400 ) ;
66+ }
67+ } ) ;
68+
69+ it ( 'rejects width below minimum' , ( ) => {
70+ const result = streakParamsSchema . safeParse ( {
71+ user : 'octocat' ,
72+ width : '99' ,
73+ } ) ;
74+
75+ expect ( result . success ) . toBe ( false ) ;
76+ } ) ;
77+
78+ it ( 'rejects width above maximum' , ( ) => {
79+ const result = streakParamsSchema . safeParse ( {
80+ user : 'octocat' ,
81+ width : '1201' ,
82+ } ) ;
83+
84+ expect ( result . success ) . toBe ( false ) ;
85+ } ) ;
86+
87+ it ( 'accepts a valid height value' , ( ) => {
88+ const result = streakParamsSchema . safeParse ( {
89+ user : 'octocat' ,
90+ height : '120' ,
91+ } ) ;
92+
93+ expect ( result . success ) . toBe ( true ) ;
94+
95+ if ( result . success ) {
96+ expect ( result . data . height ) . toBe ( 120 ) ;
97+ }
98+ } ) ;
99+
100+ it ( 'rejects height below minimum' , ( ) => {
101+ const result = streakParamsSchema . safeParse ( {
102+ user : 'octocat' ,
103+ height : '79' ,
104+ } ) ;
105+
106+ expect ( result . success ) . toBe ( false ) ;
107+ } ) ;
108+
109+ it ( 'rejects height above maximum' , ( ) => {
110+ const result = streakParamsSchema . safeParse ( {
111+ user : 'octocat' ,
112+ height : '801' ,
113+ } ) ;
114+
115+ expect ( result . success ) . toBe ( false ) ;
116+ } ) ;
117+
118+ it ( 'rejects non-numeric width values' , ( ) => {
119+ const result = streakParamsSchema . safeParse ( {
120+ user : 'octocat' ,
121+ width : 'abc' ,
122+ } ) ;
123+
124+ expect ( result . success ) . toBe ( false ) ;
125+ } ) ;
126+
127+ it ( 'leaves width undefined when omitted' , ( ) => {
128+ const result = streakParamsSchema . safeParse ( {
129+ user : 'octocat' ,
130+ } ) ;
131+
132+ expect ( result . success ) . toBe ( true ) ;
133+
134+ if ( result . success ) {
135+ expect ( result . data . width ) . toBeUndefined ( ) ;
136+ }
137+ } ) ;
138+
56139 it ( 'should fail when user is missing' , ( ) => {
57140 const result = streakParamsSchema . safeParse ( { } ) ;
58141
0 commit comments