Skip to content

Commit

Permalink
Test cases for SET_PER_PAGE action
Browse files Browse the repository at this point in the history
  • Loading branch information
sagarbakhtar committed May 21, 2019
1 parent e167bb8 commit 1c44b15
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,31 @@ describe('Query Reducer', () => {
});
});
});
describe('SET_PER_PAGE action', () => {
it('should update per page count', () => {
const updatedState = queryReducer(
{
perPage: 10,
},
{
type: 'SET_PER_PAGE',
payload: 25,
}
);
assert.equal(updatedState.perPage, 25);
});
it('should reset page to 1', () => {
const updatedState = queryReducer(
{
page: 5,
perPage: 10,
},
{
type: 'SET_PER_PAGE',
payload: 25,
}
);
assert.equal(updatedState.page, 1);
});
});
});

0 comments on commit 1c44b15

Please sign in to comment.