@@ -197,6 +197,8 @@ describe("UsersPage", () => {
197
197
expect ( users . length ) . toEqual ( 3 )
198
198
} )
199
199
200
+
201
+
200
202
describe ( "suspend user" , ( ) => {
201
203
describe ( "when it is success" , ( ) => {
202
204
it ( "shows a success message and refresh the page" , async ( ) => {
@@ -238,6 +240,28 @@ describe("UsersPage", () => {
238
240
} )
239
241
} )
240
242
243
+ describe ( "pagination" , ( ) => {
244
+ it ( "goes to next and previous page" , async ( ) => {
245
+ renderPage ( )
246
+ const user = userEvent . setup ( )
247
+
248
+ const mock = jest
249
+ . spyOn ( API , "getUsers" )
250
+ . mockResolvedValueOnce ( [ MockUser , MockUser2 ] )
251
+
252
+ const nextButton = await screen . findByLabelText ( "Next page" )
253
+ await user . click ( nextButton )
254
+
255
+ await waitFor ( ( ) => expect ( API . getUsers ) . toBeCalledWith ( { offset : 25 , limit : 25 , q : "" } ) )
256
+
257
+ mock . mockClear ( )
258
+ const previousButton = await screen . findByLabelText ( "Previous page" )
259
+ await user . click ( previousButton )
260
+
261
+ await waitFor ( ( ) => expect ( API . getUsers ) . toBeCalledWith ( { offset : 0 , limit : 25 , q : "" } ) )
262
+ } )
263
+ } )
264
+
241
265
describe ( "delete user" , ( ) => {
242
266
describe ( "when it is success" , ( ) => {
243
267
it ( "shows a success message and refresh the page" , async ( ) => {
0 commit comments