aboutsummaryrefslogtreecommitdiffstats
path: root/spec/javascripts
diff options
context:
space:
mode:
authorThomas Haddad2017-03-13 16:58:45 +0100
committerThomas Haddad2017-03-13 16:58:45 +0100
commita473fe3aa7a73df1a85a89eb678097bfe8bfe931 (patch)
treee57de0119f7e88045831364fc72106f9cd3eb397 /spec/javascripts
parent2180edc34c7936e3e9a507a36cdf2200553bed90 (diff)
downloadchouette-core-a473fe3aa7a73df1a85a89eb678097bfe8bfe931.tar.bz2
Refs #2776: Fix TotalCount with new json, and check when no vj
Signed-off-by: Thomas Shawarma Haddad <thomas.haddad@af83.com>
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/vehicle_journeys/actions_spec.js10
-rw-r--r--spec/javascripts/vehicle_journeys/reducers/pagination_spec.js9
2 files changed, 19 insertions, 0 deletions
diff --git a/spec/javascripts/vehicle_journeys/actions_spec.js b/spec/javascripts/vehicle_journeys/actions_spec.js
index 6916f463f..b9876b331 100644
--- a/spec/javascripts/vehicle_journeys/actions_spec.js
+++ b/spec/javascripts/vehicle_journeys/actions_spec.js
@@ -396,3 +396,13 @@ describe('when submitting new vj', () => {
expect(actions.updateTotalCount(diff)).toEqual(expectedAction)
})
})
+describe('when receiving vj', () => {
+ it('should create an action to show pagination totalCount', () => {
+ const total = 1
+ const expectedAction = {
+ type: 'RECEIVE_TOTAL_COUNT',
+ total
+ }
+ expect(actions.receiveTotalCount(total)).toEqual(expectedAction)
+ })
+})
diff --git a/spec/javascripts/vehicle_journeys/reducers/pagination_spec.js b/spec/javascripts/vehicle_journeys/reducers/pagination_spec.js
index ff74e1a0d..57417a3b9 100644
--- a/spec/javascripts/vehicle_journeys/reducers/pagination_spec.js
+++ b/spec/javascripts/vehicle_journeys/reducers/pagination_spec.js
@@ -18,6 +18,15 @@ describe('pagination reducer, given parameters allowing page change', () => {
).toEqual({})
})
+ it('should handle RECEIVE_TOTAL_COUNT', () => {
+ expect(
+ reducer(state, {
+ type: 'RECEIVE_TOTAL_COUNT',
+ total: 1
+ })
+ ).toEqual(Object.assign({}, state, {totalCount: 1}))
+ })
+
it('should handle RESET_PAGINATION', () => {
expect(
reducer(state, {