diff options
| author | Zog | 2018-01-29 10:32:05 +0100 | 
|---|---|---|
| committer | Zog | 2018-01-29 10:32:05 +0100 | 
| commit | ddd83906ce4fab3d6dce0c404ec39c3b500ba96f (patch) | |
| tree | 0cc2cbddf35273ba3a93f10240c0f71dffcebf33 /spec/javascript | |
| parent | 05bc96db48a0a84fd2c50e457dc767f88950a9b4 (diff) | |
| download | chouette-core-ddd83906ce4fab3d6dce0c404ec39c3b500ba96f.tar.bz2 | |
Refs #5750; Add a validation on VehicleJourneys
Ensure a time is set for all non-commercial stops
Diffstat (limited to 'spec/javascript')
| -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 = { | 
