@@ -4,15 +4,15 @@ it('should return no pagination if not enough items are given', () => {
44 const page = 0
55 const size = 5
66 const total = 2
7- const pagination = calculatePagination ( page , size , total , 5 , 0 )
7+ const pagination = calculatePagination ( page , size , total , { firstPage : 0 } )
88
99 expect ( pagination ) . toBeNull ( )
1010} )
1111it ( 'should return only a few pages' , ( ) => {
1212 const page = 1
1313 const size = 5
1414 const total = 15
15- const pagination = calculatePagination ( page , size , total , 5 , 0 )
15+ const pagination = calculatePagination ( page , size , total , { firstPage : 0 } )
1616
1717 expect ( pagination ) . not . toBeNull ( )
1818 expect ( pagination ?. pages ) . toHaveLength ( 3 )
@@ -29,7 +29,10 @@ it('should return the maximum number of pages', () => {
2929 const size = 5
3030 const total = 50
3131 const maxPages = 5
32- const pagination = calculatePagination ( page , size , total , maxPages , 0 )
32+ const pagination = calculatePagination ( page , size , total , {
33+ firstPage : 0 ,
34+ maxPages : maxPages ,
35+ } )
3336
3437 expect ( pagination ) . not . toBeNull ( )
3538 expect ( pagination ?. pages ) . toHaveLength ( 5 )
@@ -49,7 +52,7 @@ it('should disable the previous link', () => {
4952 const page = 0
5053 const size = 5
5154 const total = 10
52- const pagination = calculatePagination ( page , size , total , 5 , 0 )
55+ const pagination = calculatePagination ( page , size , total , { firstPage : 0 } )
5356
5457 expect ( pagination ) . not . toBeNull ( )
5558
@@ -66,7 +69,7 @@ it('should disable the next link', () => {
6669 const page = 1
6770 const size = 5
6871 const total = 10
69- const pagination = calculatePagination ( page , size , total , 5 , 0 )
72+ const pagination = calculatePagination ( page , size , total , { firstPage : 0 } )
7073
7174 expect ( pagination ) . not . toBeNull ( )
7275
0 commit comments