From bf7e7b9db4261aed7eb317ffb28c1652eaba5a18 Mon Sep 17 00:00:00 2001 From: Thomas Haddad Date: Mon, 14 Nov 2016 14:49:53 +0100 Subject: Add Teaspoon / Phantomjs & action tests Signed-off-by: Thomas Shawarma Haddad --- spec/javascripts/actions_spec.js | 52 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 spec/javascripts/actions_spec.js (limited to 'spec/javascripts/actions_spec.js') diff --git a/spec/javascripts/actions_spec.js b/spec/javascripts/actions_spec.js new file mode 100644 index 000000000..43ebba77f --- /dev/null +++ b/spec/javascripts/actions_spec.js @@ -0,0 +1,52 @@ +var actions = require('es6_browserified/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 add 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 add 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 add a stop', () => { + const text = 'updated text' + const index = 1 + const expectedAction = { + type: 'UPDATE_INPUT_VALUE', + index, + text + } + expect(actions.updateInputValue(index, text)).toEqual(expectedAction) + }) +}) -- cgit v1.2.3 From a98e911bb6f60b9414b9608e1fcd61561f033d0a Mon Sep 17 00:00:00 2001 From: Thomas Haddad Date: Tue, 15 Nov 2016 17:53:46 +0100 Subject: Add for_boarding and for_alighting attributes for stop_points Signed-off-by: Thomas Shawarma Haddad --- spec/javascripts/actions_spec.js | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'spec/javascripts/actions_spec.js') diff --git a/spec/javascripts/actions_spec.js b/spec/javascripts/actions_spec.js index 43ebba77f..55de1c31f 100644 --- a/spec/javascripts/actions_spec.js +++ b/spec/javascripts/actions_spec.js @@ -19,7 +19,7 @@ describe('actions', () => { }) }) describe('actions', () => { - it('should create an action to add a stop', () => { + it('should create an action to move down a stop', () => { const index = 1 const expectedAction = { type: 'MOVE_STOP_DOWN', @@ -29,7 +29,7 @@ describe('actions', () => { }) }) describe('actions', () => { - it('should create an action to add a stop', () => { + it('should create an action to delete a stop', () => { const index = 1 const expectedAction = { type: 'DELETE_STOP', @@ -39,7 +39,7 @@ describe('actions', () => { }) }) describe('actions', () => { - it('should create an action to add a stop', () => { + it('should create an action to update the value of a stop', () => { const text = 'updated text' const index = 1 const expectedAction = { @@ -50,3 +50,22 @@ describe('actions', () => { 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) + }) +}) -- cgit v1.2.3