diff options
Diffstat (limited to 'spec/javascript/routes/actions_spec.js')
| -rw-r--r-- | spec/javascript/routes/actions_spec.js | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/spec/javascript/routes/actions_spec.js b/spec/javascript/routes/actions_spec.js new file mode 100644 index 000000000..490b1b615 --- /dev/null +++ b/spec/javascript/routes/actions_spec.js @@ -0,0 +1,101 @@ +import actions from '../../app/javascript/routes/actions' + +describe('actions', () => { + it('should create an action to add a stop', () => { + const expectedAction = { + type: 'ADD_STOP', + } + expect(actions.addStop()).toEqual(expectedAction) + }) +}) +describe('actions', () => { + it('should create an action to move up a stop', () => { + const index = 1 + const expectedAction = { + type: 'MOVE_STOP_UP', + index + } + expect(actions.moveStopUp(index)).toEqual(expectedAction) + }) +}) +describe('actions', () => { + it('should create an action to move down a stop', () => { + const index = 1 + const expectedAction = { + type: 'MOVE_STOP_DOWN', + index + } + expect(actions.moveStopDown(index)).toEqual(expectedAction) + }) +}) +describe('actions', () => { + it('should create an action to delete a stop', () => { + const index = 1 + const expectedAction = { + type: 'DELETE_STOP', + index + } + expect(actions.deleteStop(index)).toEqual(expectedAction) + }) +}) +describe('actions', () => { + it('should create an action to update the value of a stop', () => { + const text = 'updated text' + const index = 1 + const expectedAction = { + type: 'UPDATE_INPUT_VALUE', + index, + text + } + expect(actions.updateInputValue(index, text)).toEqual(expectedAction) + }) +}) + +describe('actions', () => { + it('should create an action to update the up select of a stop', () => { + const event = { + currentTarget: { + value: 'forbidden', + id: 'up' + } + } + const index = 1 + const expectedAction = { + type :'UPDATE_SELECT_VALUE', + select_id: 'up', + select_value: 'forbidden', + index + } + expect(actions.updateSelectValue(event, index)).toEqual(expectedAction) + }) +}) + +describe('actions', () => { + it('should create an action to toggle the map', () => { + const index = 1 + const expectedAction = { + type: 'TOGGLE_MAP', + index + } + expect(actions.toggleMap(index)).toEqual(expectedAction) + }) +}) + +describe('actions', () => { + it('should create an action to select a marker on the map', () => { + const index = 1 + const data = { + geometry: undefined, + registration_number: 'rn_test', + stoparea_id: 'sid_test', + text: 't_test', + user_objectid: 'uoid_test' + } + const expectedAction = { + type: 'SELECT_MARKER', + index, + data + } + expect(actions.selectMarker(index, data)).toEqual(expectedAction) + }) +}) |
