@@ -260,6 +260,36 @@ describe('API Handler Options Validation', () => {
260260 } ) . not . toThrow ( ) ;
261261 } ) ;
262262
263+ it ( 'should accept Infinity as pageSize to disable pagination' , ( ) => {
264+ expect ( ( ) => {
265+ new RestApiHandler ( {
266+ schema : client . $schema ,
267+ endpoint : 'http://localhost/api' ,
268+ pageSize : Infinity ,
269+ } ) ;
270+ } ) . not . toThrow ( ) ;
271+ } ) ;
272+
273+ it ( 'should throw error when pageSize is a decimal' , ( ) => {
274+ expect ( ( ) => {
275+ new RestApiHandler ( {
276+ schema : client . $schema ,
277+ endpoint : 'http://localhost/api' ,
278+ pageSize : 10.5 ,
279+ } ) ;
280+ } ) . toThrow ( 'Invalid options' ) ;
281+ } ) ;
282+
283+ it ( 'should throw error when pageSize is NaN' , ( ) => {
284+ expect ( ( ) => {
285+ new RestApiHandler ( {
286+ schema : client . $schema ,
287+ endpoint : 'http://localhost/api' ,
288+ pageSize : NaN ,
289+ } ) ;
290+ } ) . toThrow ( 'Invalid options' ) ;
291+ } ) ;
292+
263293 it ( 'should accept single character idDivider' , ( ) => {
264294 expect ( ( ) => {
265295 new RestApiHandler ( {
@@ -555,13 +585,11 @@ describe('API Handler Options Validation', () => {
555585 } ) ;
556586
557587 it ( 'RestApiHandler with disabled pagination (Infinity pageSize)' , ( ) => {
558- // Note: According to the code, this would need to be set to Infinity
559- // after construction, not in options, as Zod validation requires positive number
560588 expect ( ( ) => {
561589 new RestApiHandler ( {
562590 schema : client . $schema ,
563591 endpoint : 'http://localhost/api' ,
564- pageSize : 999999 , // Large number as workaround
592+ pageSize : Infinity ,
565593 } ) ;
566594 } ) . not . toThrow ( ) ;
567595 } ) ;
0 commit comments