@@ -21,13 +21,13 @@ describe('list-items tool', () => {
2121 console . error = vi . fn ( ) ;
2222 const { makeRollbarRequest } = await import ( '../../../src/utils/api.js' ) ;
2323 makeRollbarRequestMock = makeRollbarRequest as any ;
24-
24+
2525 server = {
2626 tool : vi . fn ( ( name , description , schema , handler ) => {
2727 toolHandler = handler ;
2828 } )
2929 } as any ;
30-
30+
3131 registerListItemsTool ( server ) ;
3232 } ) ;
3333
@@ -59,7 +59,7 @@ describe('list-items tool', () => {
5959 'https://api.rollbar.com/api/1/items/?status=active&environment=production' ,
6060 'list-items'
6161 ) ;
62-
62+
6363 const responseData = JSON . parse ( result . content [ 0 ] . text ) ;
6464 expect ( responseData . items ) . toHaveLength ( 1 ) ;
6565 expect ( responseData . pagination ) . toEqual ( {
@@ -90,7 +90,7 @@ describe('list-items tool', () => {
9090 'https://api.rollbar.com/api/1/items/?status=resolved&level=error&level=critical&environment=staging&page=2&q=TypeError' ,
9191 'list-items'
9292 ) ;
93-
93+
9494 const responseData = JSON . parse ( result . content [ 0 ] . text ) ;
9595 expect ( responseData . filters_applied ) . toEqual ( {
9696 status : 'resolved' ,
@@ -139,26 +139,33 @@ describe('list-items tool', () => {
139139 it ( 'should validate parameter schemas with Zod' , ( ) => {
140140 const schemaCall = ( server . tool as any ) . mock . calls [ 0 ] ;
141141 const schema = schemaCall [ 2 ] ;
142-
142+
143143 // Test status parameter
144144 expect ( schema . status . parse ( undefined ) ) . toBe ( 'active' ) ; // default
145145 expect ( schema . status . parse ( 'resolved' ) ) . toBe ( 'resolved' ) ;
146-
146+
147147 // Test level parameter
148148 expect ( schema . level . parse ( undefined ) ) . toBeUndefined ( ) ; // optional
149149 expect ( schema . level . parse ( [ 'error' , 'warning' ] ) ) . toEqual ( [ 'error' , 'warning' ] ) ;
150150 expect ( ( ) => schema . level . parse ( 'error' ) ) . toThrow ( ) ; // must be array
151-
151+
152152 // Test environment parameter
153153 expect ( schema . environment . parse ( undefined ) ) . toBe ( 'production' ) ; // default
154154 expect ( schema . environment . parse ( 'staging' ) ) . toBe ( 'staging' ) ;
155-
155+
156156 // Test page parameter
157157 expect ( schema . page . parse ( undefined ) ) . toBe ( 1 ) ; // default
158158 expect ( schema . page . parse ( 5 ) ) . toBe ( 5 ) ;
159159 expect ( ( ) => schema . page . parse ( 0 ) ) . toThrow ( ) ; // min is 1
160160 expect ( ( ) => schema . page . parse ( 3.14 ) ) . toThrow ( ) ; // must be int
161-
161+
162+ // Test limit parameter
163+ expect ( schema . limit . parse ( undefined ) ) . toBe ( 20 ) ; // default
164+ expect ( schema . limit . parse ( 50 ) ) . toBe ( 50 ) ;
165+ expect ( ( ) => schema . limit . parse ( 0 ) ) . toThrow ( ) ; // min is 1
166+ expect ( ( ) => schema . limit . parse ( 5001 ) ) . toThrow ( ) ; // max is 5000
167+ expect ( ( ) => schema . limit . parse ( 2.5 ) ) . toThrow ( ) ; // must be int
168+
162169 // Test query parameter
163170 expect ( schema . query . parse ( undefined ) ) . toBeUndefined ( ) ; // optional
164171 expect ( schema . query . parse ( 'search term' ) ) . toBe ( 'search term' ) ;
0 commit comments