aboutsummaryrefslogtreecommitdiffstats
path: root/spec/javascripts
diff options
context:
space:
mode:
authorThomas Haddad2017-01-12 11:32:34 +0100
committerThomas Haddad2017-01-12 11:34:08 +0100
commitbaabdb94cd8f5778b8df8fbb85bc42e52f11223b (patch)
tree30de0e18167279b4d9ea3e59bc92670b9996229b /spec/javascripts
parent4564af7fa10eaf1ccd18aebe9dcc14fc41e61473 (diff)
downloadchouette-core-baabdb94cd8f5778b8df8fbb85bc42e52f11223b.tar.bz2
Refs #2210: add isFetching in state for loader toggling
Signed-off-by: Thomas Shawarma Haddad <thomas.haddad@af83.com>
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/journey_patterns/actions_spec.js8
-rw-r--r--spec/javascripts/journey_patterns/reducers/status_spec.js19
2 files changed, 26 insertions, 1 deletions
diff --git a/spec/javascripts/journey_patterns/actions_spec.js b/spec/javascripts/journey_patterns/actions_spec.js
index ef0470d2d..07f83ca1b 100644
--- a/spec/javascripts/journey_patterns/actions_spec.js
+++ b/spec/javascripts/journey_patterns/actions_spec.js
@@ -144,3 +144,11 @@ describe('when submitting new journeyPatterns', () => {
expect(actions.updateTotalCount(diff)).toEqual(expectedAction)
})
})
+describe('when fetching api', () => {
+ it('should create an action to fetch api', () => {
+ const expectedAction = {
+ type: 'FETCH_API',
+ }
+ expect(actions.fetchingApi()).toEqual(expectedAction)
+ })
+})
diff --git a/spec/javascripts/journey_patterns/reducers/status_spec.js b/spec/javascripts/journey_patterns/reducers/status_spec.js
index 4eeb5c442..91cbbb0b8 100644
--- a/spec/javascripts/journey_patterns/reducers/status_spec.js
+++ b/spec/javascripts/journey_patterns/reducers/status_spec.js
@@ -2,6 +2,14 @@ var statusReducer = require('es6_browserified/journey_patterns/reducers/status')
let state = {}
+let pagination = {
+ page : 2,
+ totalCount : 25,
+ stateChanged: false,
+ perPage: 12
+}
+const dispatch = function(){}
+
describe('status reducer', () => {
beforeEach(() => {
state = {
@@ -29,6 +37,15 @@ describe('status reducer', () => {
statusReducer(state, {
type: 'RECEIVE_JOURNEY_PATTERNS'
})
- ).toEqual(Object.assign({}, state, {fetchSuccess: true}))
+ ).toEqual(Object.assign({}, state, {fetchSuccess: true, isFetching: false}))
})
+
+ it('should handle FETCH_API', () => {
+ expect(
+ statusReducer(state, {
+ type: 'FETCH_API'
+ })
+ ).toEqual(Object.assign({}, state, {isFetching: true}))
+ })
+
})