diff options
| author | Zog | 2018-01-29 10:32:05 +0100 |
|---|---|---|
| committer | cedricnjanga | 2018-02-06 11:04:27 -0800 |
| commit | 755b07db36a10ffdbd315dff2b5315374eb3e58a (patch) | |
| tree | bb9ab31042ba82725061867d5133a861e82a11a4 /spec | |
| parent | a41d3b5e861929a75c6de23150d066ba366bb577 (diff) | |
| download | chouette-core-755b07db36a10ffdbd315dff2b5315374eb3e58a.tar.bz2 | |
Refs #5750; Add a validation on VehicleJourneys
Ensure a time is set for all non-commercial stops
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/javascript/vehicle_journeys/actions_spec.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/javascript/vehicle_journeys/actions_spec.js b/spec/javascript/vehicle_journeys/actions_spec.js index 9515b57f2..d486c9af8 100644 --- a/spec/javascript/vehicle_journeys/actions_spec.js +++ b/spec/javascript/vehicle_journeys/actions_spec.js @@ -37,6 +37,47 @@ describe('when clicking on add button', () => { expect(actions.openCreateModal()).toEqual(expectedAction) }) }) +describe('when validating the form', () => { + it('should check that non-commercial stops have passing time', () => { + let state = [{ + vehicle_journey_at_stops: [{ + area_kind: "non_commercial", + departure_time: { + hour: "00", + minute: "00" + } + }] + }] + + expect(actions.validate(dispatch, state)).toEqual(false) + + state = [{ + vehicle_journey_at_stops: [{ + area_kind: "non_commercial", + departure_time: { + hour: "00", + minute: "01" + } + }] + }] + + expect(actions.validate(dispatch, state)).toEqual(true) + }) + + it('should not check that commercial stops', () => { + let state = [{ + vehicle_journey_at_stops: [{ + area_kind: "commercial", + departure_time: { + hour: "00", + minute: "00" + } + }] + }] + + expect(actions.validate(dispatch, state)).toEqual(true) + }) +}) describe('when using select2 to pick a journey pattern', () => { it('should create an action to select a journey pattern inside modal', () => { let selectedJP = { |
