aboutsummaryrefslogtreecommitdiffstats
path: root/spec/javascripts
diff options
context:
space:
mode:
authorThomas Haddad2017-01-11 12:09:31 +0100
committerThomas Haddad2017-01-11 12:10:13 +0100
commit221300caac758edf7cdb34ec26f41952a2401728 (patch)
treef7d72303ee4eb942577bab5d38ffee30470514c5 /spec/javascripts
parentac64a2c779174a7ecd125d761364cbe9b4e9e30a (diff)
downloadchouette-core-221300caac758edf7cdb34ec26f41952a2401728.tar.bz2
Add update journey patterns length after submitting correct values
Signed-off-by: Thomas Shawarma Haddad <thomas.haddad@af83.com>
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/journey_patterns/actions_spec.js6
-rw-r--r--spec/javascripts/journey_patterns/reducers/pagination_spec.js9
2 files changed, 13 insertions, 2 deletions
diff --git a/spec/javascripts/journey_patterns/actions_spec.js b/spec/javascripts/journey_patterns/actions_spec.js
index 03198c2c4..736a4326a 100644
--- a/spec/javascripts/journey_patterns/actions_spec.js
+++ b/spec/javascripts/journey_patterns/actions_spec.js
@@ -26,13 +26,17 @@ describe('when landing on page', () => {
describe('when next navigation button is clicked', () => {
it('should create an action to go to next page', () => {
const nextPage = true
+ const totalCount = 25
+ const perPage = 12
const expectedAction = {
type: 'GO_TO_NEXT_PAGE',
dispatch,
currentPage,
+ totalCount,
+ perPage,
nextPage
}
- expect(actions.goToNextPage(dispatch, currentPage)).toEqual(expectedAction)
+ expect(actions.goToNextPage(dispatch, currentPage, totalCount, perPage)).toEqual(expectedAction)
})
})
describe('when clicking on a journey pattern checkbox', () => {
diff --git a/spec/javascripts/journey_patterns/reducers/pagination_spec.js b/spec/javascripts/journey_patterns/reducers/pagination_spec.js
index 1c8011fca..430db4b64 100644
--- a/spec/javascripts/journey_patterns/reducers/pagination_spec.js
+++ b/spec/javascripts/journey_patterns/reducers/pagination_spec.js
@@ -1,7 +1,11 @@
var reducer = require('es6_browserified/journey_patterns/reducers/pagination')
+
+const totalCount = 25
+const perPage = 12
let state = {
page : 2,
- totalCount : 25
+ totalCount : totalCount,
+ stateChanged: false
}
let currentPage = 2
const dispatch = function(){}
@@ -20,6 +24,8 @@ describe('pagination reducer, given parameters allowing page change', () => {
type: 'GO_TO_NEXT_PAGE',
dispatch,
currentPage,
+ totalCount,
+ perPage,
nextPage : true
})
).toEqual(Object.assign({}, state, {page : state.page + 1, stateChanged: false}))
@@ -70,6 +76,7 @@ describe('pagination reducer, given parameters not allowing to go to next page',
type: 'GO_TO_NEXT_PAGE',
dispatch,
currentPage,
+ totalCount,
nextPage : false
})
).toEqual(state)