diff options
| -rw-r--r-- | INSTALL.md | 4 | ||||
| -rw-r--r-- | spec/javascripts/time_table/reducers/modal_spec.js | 72 |
2 files changed, 71 insertions, 5 deletions
diff --git a/INSTALL.md b/INSTALL.md index 2d23a70ce..b45c0bf7b 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -108,7 +108,9 @@ If you have access to STIF CodifLigne and Reflex : **N.B.** These are asynchronious tasks, you can observe the launched jobs in your [Sidekiq Console](http://localhost:3000/sidekiq) -To create Referential with some data (Route, JourneyPattern, VehicleJourney, etc) : +#### Data in various Apartments (Referentials) + +To create `Referential` objects with some data (`Route`, `JourneyPattern`, `VehicleJourney`, etc) : bundle exec rake referential:create diff --git a/spec/javascripts/time_table/reducers/modal_spec.js b/spec/javascripts/time_table/reducers/modal_spec.js index ceed0a43e..4246027b8 100644 --- a/spec/javascripts/time_table/reducers/modal_spec.js +++ b/spec/javascripts/time_table/reducers/modal_spec.js @@ -137,10 +137,7 @@ describe('modal reducer', () => { ).toEqual(Object.assign({}, state, {modalProps: newModalProps})) }) - it('should handle VALIDATE_PERIOD_FORM', () => { - // if period_end <= period_start, throw error - // if newperiod is on another one, throw error - + it('should handle VALIDATE_PERIOD_FORM and throw error if period starts after the end', () => { let modProps = { active: false, begin: { @@ -182,4 +179,71 @@ describe('modal reducer', () => { }) ).toEqual(Object.assign({}, state, {modalProps: newModalProps})) }) + + it('should handle VALIDATE_PERIOD_FORM and throw error if periods overlap', () => { + let state2 = { + confirmModal: {}, + modalProps: { + active: false, + begin: { + day: '03', + month: '05', + year: '2017' + }, + end: { + day: '09', + month: '05', + year: '2017' + }, + index: false, + error: '' + }, + type: '' + } + let modProps2 = { + active: false, + begin: { + day: '03', + month: '05', + year: '2017' + }, + end: { + day: '09', + month: '05', + year: '2017' + }, + index: false, + error: '' + } + let ttperiods2 = [ + {id: 261, period_start: '2017-02-23', period_end: '2017-03-05'}, + {id: 262, period_start: '2017-03-15', period_end: '2017-03-25'}, + {id: 264, period_start: '2017-04-24', period_end: '2017-05-04'}, + {id: 265, period_start: '2017-05-14', period_end: '2017-05-24'} + ] + + let newModalProps2 = { + active: true, + begin: { + day: '03', + month: '05', + year: '2017' + }, + end: { + day: '09', + month: '05', + year: '2017' + }, + index: false, + error: "Les périodes ne peuvent pas se chevaucher" + } + + expect( + modalReducer(state2, { + type: 'VALIDATE_PERIOD_FORM', + modalProps : modProps2, + timeTablePeriods: ttperiods2 + }) + ).toEqual(Object.assign({}, state2, {modalProps: newModalProps2})) + }) }) |
