aboutsummaryrefslogtreecommitdiffstats
path: root/spec/javascripts
diff options
context:
space:
mode:
authorThomas Haddad2017-03-10 16:25:23 +0100
committerThomas Haddad2017-03-10 16:25:54 +0100
commit54254d44578a8d5057a3dc7738ae570f55720833 (patch)
treef0fd5b6b8e1f37dbc529f1f1cdba86f3d98a634d /spec/javascripts
parenta41d0c93833ad846b3903c0529328638e6d88be3 (diff)
downloadchouette-core-54254d44578a8d5057a3dc7738ae570f55720833.tar.bz2
Fix add vj when no vj fetched before
Signed-off-by: Thomas Shawarma Haddad <thomas.haddad@af83.com>
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/vehicle_journeys/actions_spec.js12
-rw-r--r--spec/javascripts/vehicle_journeys/reducers/vehicle_journeys_spec.js14
2 files changed, 16 insertions, 10 deletions
diff --git a/spec/javascripts/vehicle_journeys/actions_spec.js b/spec/javascripts/vehicle_journeys/actions_spec.js
index ec52036d6..6916f463f 100644
--- a/spec/javascripts/vehicle_journeys/actions_spec.js
+++ b/spec/javascripts/vehicle_journeys/actions_spec.js
@@ -43,7 +43,8 @@ describe('when using select2 to pick a journey pattern', () => {
id: 1,
object_id: 2,
name: 'test',
- published_name: 'test'
+ published_name: 'test',
+ stop_area_short_descriptions: ['test']
}
const expectedAction = {
type: 'SELECT_JP_CREATE_MODAL',
@@ -51,7 +52,8 @@ describe('when using select2 to pick a journey pattern', () => {
id: selectedJP.id,
objectid: selectedJP.object_id,
name: selectedJP.name,
- published_name: selectedJP.published_name
+ published_name: selectedJP.published_name,
+ stop_areas: selectedJP.stop_area_short_descriptions
}
}
expect(actions.selectJPCreateModal(selectedJP)).toEqual(expectedAction)
@@ -61,12 +63,14 @@ describe('when clicking on validate button inside create modal', () => {
it('should create an action to create a new vehicle journey', () => {
const data = {}
const selectedJourneyPattern = {}
+ const stopPointsList = []
const expectedAction = {
type: 'ADD_VEHICLEJOURNEY',
data,
- selectedJourneyPattern
+ selectedJourneyPattern,
+ stopPointsList
}
- expect(actions.addVehicleJourney(data, selectedJourneyPattern)).toEqual(expectedAction)
+ expect(actions.addVehicleJourney(data, selectedJourneyPattern, stopPointsList)).toEqual(expectedAction)
})
})
describe('when previous navigation button is clicked', () => {
diff --git a/spec/javascripts/vehicle_journeys/reducers/vehicle_journeys_spec.js b/spec/javascripts/vehicle_journeys/reducers/vehicle_journeys_spec.js
index dbdb253c7..f1c9798af 100644
--- a/spec/javascripts/vehicle_journeys/reducers/vehicle_journeys_spec.js
+++ b/spec/javascripts/vehicle_journeys/reducers/vehicle_journeys_spec.js
@@ -73,7 +73,7 @@ describe('vehicleJourneys reducer', () => {
it('should handle ADD_VEHICLEJOURNEY', () => {
- let resultVJ = [{
+ let pristineVjasList = [{
delta : 0,
arrival_time : {
hour: '00',
@@ -82,26 +82,28 @@ describe('vehicleJourneys reducer', () => {
departure_time : {
hour: '00',
minute: '00'
- }
+ },
+ stop_point_objectid: 'test',
+ dummy: true
}]
let fakeData = {
published_journey_name: {value: 'test'}
}
- let fakeSelectedJourneyPattern = { id: "1"}
+ let fakeSelectedJourneyPattern = {id: "1"}
expect(
vjReducer(state, {
type: 'ADD_VEHICLEJOURNEY',
data: fakeData,
- selectedJourneyPattern: fakeSelectedJourneyPattern
+ selectedJourneyPattern: fakeSelectedJourneyPattern,
+ stopPointsList: [{object_id: 'test'}]
})
).toEqual([{
- dummy: false,
journey_pattern: fakeSelectedJourneyPattern,
published_journey_name: 'test',
objectid: '',
footnotes: [],
time_tables: [],
- vehicle_journey_at_stops: resultVJ,
+ vehicle_journey_at_stops: pristineVjasList,
selected: false,
deletable: false
}, ...state])