aboutsummaryrefslogtreecommitdiffstats
path: root/spec/javascript
diff options
context:
space:
mode:
authorZog2018-01-17 11:44:15 +0100
committerZog2018-01-17 11:44:15 +0100
commit351af77182537dbb53e7bbd99d37dde50cd11ffe (patch)
tree65a44b751fe4002fc885d9649eeb44857aa14316 /spec/javascript
parent3ccd38eaf70078271813c98a8ead64d6cb94230c (diff)
downloadchouette-core-5614-fix-schedule-computation.tar.bz2
Refs #5614 @0.5h; Fix schedule computation when departure minutes are not set5614-fix-schedule-computation
Diffstat (limited to 'spec/javascript')
-rw-r--r--spec/javascript/vehicle_journeys/reducers/vehicleJourneys_spec.js77
1 files changed, 77 insertions, 0 deletions
diff --git a/spec/javascript/vehicle_journeys/reducers/vehicleJourneys_spec.js b/spec/javascript/vehicle_journeys/reducers/vehicleJourneys_spec.js
index 31973b390..0d7612a80 100644
--- a/spec/javascript/vehicle_journeys/reducers/vehicleJourneys_spec.js
+++ b/spec/javascript/vehicle_journeys/reducers/vehicleJourneys_spec.js
@@ -241,6 +241,83 @@ describe('vehicleJourneys reducer', () => {
}, ...state])
})
+ it('should handle ADD_VEHICLEJOURNEY with a start time and a fully timed JP but the minutes are not set', () => {
+ let pristineVjasList = [{
+ delta : 0,
+ arrival_time : {
+ hour: 22,
+ minute: 0
+ },
+ departure_time : {
+ hour: 22,
+ minute: 0
+ },
+ stop_point_objectid: 'test-1',
+ stop_area_cityname: 'city',
+ dummy: false
+ },
+ {
+ delta : 0,
+ arrival_time : {
+ hour: 22,
+ minute: 3
+ },
+ departure_time : {
+ hour: 22,
+ minute: 3
+ },
+ stop_point_objectid: 'test-2',
+ stop_area_cityname: 'city',
+ dummy: false
+ }]
+ let fakeData = {
+ published_journey_name: {value: 'test'},
+ published_journey_identifier: {value : ''},
+ "start_time.hour": {value : '22'},
+ "start_time.minute": {value : ''}
+ }
+ let fakeSelectedJourneyPattern = {
+ id: "1",
+ full_schedule: true,
+ stop_areas: [
+ {stop_area_short_description: {id: 1}},
+ {stop_area_short_description: {id: 2}},
+ ],
+ costs: {
+ "1-2": {
+ distance: 10,
+ time: 63
+ },
+ }
+ }
+ let fakeSelectedCompany = {name: "ALBATRANS"}
+ expect(
+ vjReducer(state, {
+ type: 'ADD_VEHICLEJOURNEY',
+ data: fakeData,
+ selectedJourneyPattern: fakeSelectedJourneyPattern,
+ stopPointsList: [{object_id: 'test-1', city_name: 'city', stop_area_id: 1, id: 1, time_zone_offset: 0}, {object_id: 'test-2', city_name: 'city', stop_area_id: 2, id: 2, time_zone_offset: -3600}],
+ selectedCompany: fakeSelectedCompany
+ })
+ ).toEqual([{
+ journey_pattern: fakeSelectedJourneyPattern,
+ company: fakeSelectedCompany,
+ published_journey_name: 'test',
+ published_journey_identifier: '',
+ short_id: '',
+ objectid: '',
+ footnotes: [],
+ time_tables: [],
+ purchase_windows: [],
+ vehicle_journey_at_stops: pristineVjasList,
+ selected: false,
+ custom_fields: undefined,
+ deletable: false,
+ transport_mode: 'undefined',
+ transport_submode: 'undefined'
+ }, ...state])
+ })
+
it('should handle RECEIVE_VEHICLE_JOURNEYS', () => {
expect(
vjReducer(state, {