From ec224c3a86678c6765a8f5a4ba6700e66b747cc7 Mon Sep 17 00:00:00 2001 From: Thomas Haddad Date: Thu, 23 Feb 2017 14:46:05 +0100 Subject: Refs #2521: Add edit modal for vj medatatas (only comment editable) Signed-off-by: Thomas Shawarma Haddad --- spec/javascripts/vehicle_journeys/actions_spec.js | 10 ++++++++++ .../vehicle_journeys/reducers/vehicle_journeys_spec.js | 13 +++++++++++++ 2 files changed, 23 insertions(+) (limited to 'spec/javascripts') diff --git a/spec/javascripts/vehicle_journeys/actions_spec.js b/spec/javascripts/vehicle_journeys/actions_spec.js index 952c80312..5d01ac284 100644 --- a/spec/javascripts/vehicle_journeys/actions_spec.js +++ b/spec/javascripts/vehicle_journeys/actions_spec.js @@ -132,6 +132,16 @@ describe('when clicking on validate button inside shifting modal', () => { expect(actions.shiftVehicleJourney(data)).toEqual(expectedAction) }) }) +describe('when clicking on validate button inside editing modal', () => { + it('should create an action to update a vehiclejourney', () => { + const data = {} + const expectedAction = { + type: 'EDIT_VEHICLEJOURNEY', + data + } + expect(actions.editVehicleJourney(data)).toEqual(expectedAction) + }) +}) describe('when clicking on validate button inside duplicating modal', () => { it('should create an action to duplicate a vehiclejourney schedule', () => { const data = {} diff --git a/spec/javascripts/vehicle_journeys/reducers/vehicle_journeys_spec.js b/spec/javascripts/vehicle_journeys/reducers/vehicle_journeys_spec.js index dc04d5bf7..35d53a1fd 100644 --- a/spec/javascripts/vehicle_journeys/reducers/vehicle_journeys_spec.js +++ b/spec/javascripts/vehicle_journeys/reducers/vehicle_journeys_spec.js @@ -201,4 +201,17 @@ describe('vehicleJourneys reducer', () => { }) ).toEqual([state[0], newVJ, state[1]]) }) + + it('should handle EDIT_VEHICLEJOURNEY', () => { + let fakeData = { + comment: {value : 'toto'}, + } + let newVJ = Object.assign({}, state[0], {comment: fakeData.comment.value}) + expect( + vjReducer(state, { + type: 'EDIT_VEHICLEJOURNEY', + data: fakeData + }) + ).toEqual([newVJ, state[1]]) + }) }) -- cgit v1.2.3