diff options
| author | Zog | 2018-02-21 16:05:25 +0100 |
|---|---|---|
| committer | Zog | 2018-02-21 16:19:08 +0100 |
| commit | d718159ff008c25ab7d51c6714444bd7bd24a77d (patch) | |
| tree | eb2e7571ac0ce3eab1125a992a66d92e81d73bf8 /spec/javascript | |
| parent | 70396ae000bfc5c2b792c17198efc2a8d87d9ebf (diff) | |
| download | chouette-core-d718159ff008c25ab7d51c6714444bd7bd24a77d.tar.bz2 | |
Refs #5944; Skip automated times calculation when no start time is set5944-skip-schedule-calculation-when-no-time-is-set
Diffstat (limited to 'spec/javascript')
| -rw-r--r-- | spec/javascript/vehicle_journeys/reducers/vehicleJourneys_spec.js | 77 |
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 389c60add..d5a35bdc1 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 no time is set', () => { + let pristineVjasList = [{ + delta : 0, + arrival_time : { + hour: 0, + minute: 0 + }, + departure_time : { + hour: 0, + minute: 0 + }, + stop_point_objectid: 'test-1', + stop_area_cityname: 'city', + dummy: false + }, + { + delta : 0, + arrival_time : { + hour: 0, + minute: 0 + }, + departure_time : { + hour: 0, + minute: 0 + }, + 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 : ''}, + "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 ADD_VEHICLEJOURNEY with a start time and a fully timed JP but the minutes are not set', () => { let pristineVjasList = [{ delta : 0, |
