From bb10391face1fb10689e2210d192a918a2078aa0 Mon Sep 17 00:00:00 2001 From: Thomas Haddad Date: Wed, 8 Mar 2017 15:01:37 +0100 Subject: Refs #2507: fix whole query system with batchActions and queryString Signed-off-by: Thomas Shawarma Haddad --- spec/javascripts/vehicle_journeys/actions_spec.js | 19 ++++++++++++++----- .../vehicle_journeys/reducers/filters_spec.js | 5 +++-- 2 files changed, 17 insertions(+), 7 deletions(-) (limited to 'spec/javascripts') diff --git a/spec/javascripts/vehicle_journeys/actions_spec.js b/spec/javascripts/vehicle_journeys/actions_spec.js index 45e43ab9f..ac73462e0 100644 --- a/spec/javascripts/vehicle_journeys/actions_spec.js +++ b/spec/javascripts/vehicle_journeys/actions_spec.js @@ -72,6 +72,7 @@ describe('when clicking on validate button inside create modal', () => { describe('when previous navigation button is clicked', () => { it('should create an action to go to previous page', () => { const nextPage = false + const queryString = '' const pagination = { totalCount: 25, perPage: 12, @@ -81,13 +82,15 @@ describe('when previous navigation button is clicked', () => { type: 'GO_TO_PREVIOUS_PAGE', dispatch, pagination, - nextPage + nextPage, + queryString } - expect(actions.goToPreviousPage(dispatch, pagination)).toEqual(expectedAction) + expect(actions.goToPreviousPage(dispatch, pagination, queryString)).toEqual(expectedAction) }) }) describe('when next navigation button is clicked', () => { it('should create an action to go to next page', () => { + const queryString = '' const nextPage = true const pagination = { totalCount: 25, @@ -98,9 +101,10 @@ describe('when next navigation button is clicked', () => { type: 'GO_TO_NEXT_PAGE', dispatch, pagination, - nextPage + nextPage, + queryString } - expect(actions.goToNextPage(dispatch, pagination)).toEqual(expectedAction) + expect(actions.goToNextPage(dispatch, pagination, queryString)).toEqual(expectedAction) }) }) describe('when checking a vehicleJourney', () => { @@ -273,7 +277,12 @@ describe('when using select2 to pick a timetable', () => { describe('when clicking on reset button inside query filters', () => { it('should create an action to reset the query filters', () => { const expectedAction = { - type: 'RESET_FILTERS', + type: 'BATCH', + payload: [ + {type: 'RESET_FILTERS'}, + {type: 'RESET_PAGINATION'}, + {type: 'QUERY_FILTER_VEHICLEJOURNEYS', dispatch: undefined}, + ] } expect(actions.resetFilters()).toEqual(expectedAction) }) diff --git a/spec/javascripts/vehicle_journeys/reducers/filters_spec.js b/spec/javascripts/vehicle_journeys/reducers/filters_spec.js index 02072192f..c985733c8 100644 --- a/spec/javascripts/vehicle_journeys/reducers/filters_spec.js +++ b/spec/javascripts/vehicle_journeys/reducers/filters_spec.js @@ -29,8 +29,9 @@ describe('filters reducer', () => { }, journeyPattern: {}, timetable: {}, - withoutSchedule: false - } + withoutSchedule: false, + }, + queryString: '' } }) -- cgit v1.2.3