Skip to content
This repository has been archived by the owner on Dec 22, 2019. It is now read-only.

Commit

Permalink
added tests for setTotalItems and setTotalPages helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugene Samonenko authored and ambroseus committed Nov 27, 2019
1 parent 61d726c commit 783a5a4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/__tests__/processes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ async function testFetch() {
await new Promise(resolve => setTimeout(resolve, 10))
return {
data: testItems,
totalItems: 5,
totalPages: 1,
}
}

Expand Down Expand Up @@ -82,8 +84,10 @@ const stateAfter = {
},
itemProps: {
testItem: {
currentPage: 3,
currentPage: 0,
pageSize: 10,
totalItems: 5,
totalPages: 1,
},
},
filters: {},
Expand Down Expand Up @@ -130,7 +134,7 @@ function* loadItemsSaga() {
}

describe('process helper', () => {
it('should run loadItemsSaga', async () => {
it('should successfully execute loadItemsSaga', async () => {
sagaTester.start(testSaga)
expect(sagaTester.getState()).toEqual(initialState)

Expand All @@ -152,5 +156,8 @@ describe('process helper', () => {
expect(dckSelectors.getItems(state, TestItem)).toEqual(testItems)
expect(dckSelectors.getActiveItem(state, TestItem)).toEqual(testItems[1])
expect(dckSelectors.getPageSize(state, TestItem)).toEqual(10)
expect(dckSelectors.getCurrentPage(state, TestItem)).toEqual(0)
expect(dckSelectors.getTotalItems(state, TestItem)).toEqual(5)
expect(dckSelectors.getTotalPages(state, TestItem)).toEqual(1)
})
})

0 comments on commit 783a5a4

Please sign in to comment.