aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Haddad2017-01-11 12:17:18 +0100
committerThomas Haddad2017-01-11 12:17:18 +0100
commit3717719e3487a0433c0d53d4494ac315bd966f89 (patch)
tree5f0fcd677d8883068893c7d3bc99a8ecc068b786
parent221300caac758edf7cdb34ec26f41952a2401728 (diff)
downloadchouette-core-3717719e3487a0433c0d53d4494ac315bd966f89.tar.bz2
Add updateTotalCount specs
Signed-off-by: Thomas Shawarma Haddad <thomas.haddad@af83.com>
-rw-r--r--spec/javascripts/journey_patterns/actions_spec.js10
-rw-r--r--spec/javascripts/journey_patterns/reducers/pagination_spec.js13
2 files changed, 23 insertions, 0 deletions
diff --git a/spec/javascripts/journey_patterns/actions_spec.js b/spec/javascripts/journey_patterns/actions_spec.js
index 736a4326a..4b7cb1f79 100644
--- a/spec/javascripts/journey_patterns/actions_spec.js
+++ b/spec/javascripts/journey_patterns/actions_spec.js
@@ -134,3 +134,13 @@ describe('when clicking on validate button at the bottom of the page', () => {
expect(actions.savePage(dispatch)).toEqual(expectedAction)
})
})
+describe('when submitting new journeyPatterns', () => {
+ it('should create an action to update pagination totalCount', () => {
+ const diff = 1
+ const expectedAction = {
+ type: 'UPDATE_TOTAL_COUNT',
+ diff
+ }
+ expect(actions.updateTotalCount(diff)).toEqual(expectedAction)
+ })
+})
diff --git a/spec/javascripts/journey_patterns/reducers/pagination_spec.js b/spec/javascripts/journey_patterns/reducers/pagination_spec.js
index 430db4b64..8107794f6 100644
--- a/spec/javascripts/journey_patterns/reducers/pagination_spec.js
+++ b/spec/javascripts/journey_patterns/reducers/pagination_spec.js
@@ -1,6 +1,7 @@
var reducer = require('es6_browserified/journey_patterns/reducers/pagination')
const totalCount = 25
+const diff = 1
const perPage = 12
let state = {
page : 2,
@@ -82,3 +83,15 @@ describe('pagination reducer, given parameters not allowing to go to next page',
).toEqual(state)
})
})
+
+describe('pagination reducer, given parameters changing totalCount', () => {
+
+ it('should return UPDATE_TOTAL_COUNT and update totalCount', () => {
+ expect(
+ reducer(state, {
+ type: 'UPDATE_TOTAL_COUNT',
+ diff
+ })
+ ).toEqual(Object.assign({}, state, {totalCount: totalCount - diff}))
+ })
+})