From 221300caac758edf7cdb34ec26f41952a2401728 Mon Sep 17 00:00:00 2001 From: Thomas Haddad Date: Wed, 11 Jan 2017 12:09:31 +0100 Subject: Add update journey patterns length after submitting correct values Signed-off-by: Thomas Shawarma Haddad --- spec/javascripts/journey_patterns/actions_spec.js | 6 +++++- spec/javascripts/journey_patterns/reducers/pagination_spec.js | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'spec/javascripts') 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) -- cgit v1.2.3