aboutsummaryrefslogtreecommitdiffstats
path: root/spec/javascripts
diff options
context:
space:
mode:
authorRobert2017-04-24 14:16:52 +0200
committerRobert2017-04-24 14:16:52 +0200
commit2d19e65fa8d8ac037c7f00a638111788b7ee002c (patch)
tree830fe41ac13743f75f2c16f41dfd1ff399b99a9b /spec/javascripts
parent5003acfc533baa824fed11cf6f82f86393b3a0f6 (diff)
parent1cbed80c913420c76ac7d3716b9d8c4bf4e14278 (diff)
downloadchouette-core-2d19e65fa8d8ac037c7f00a638111788b7ee002c.tar.bz2
conflict resolution and asset recompilation
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/time_table/actions_spec.js27
-rw-r--r--spec/javascripts/time_table/reducers/metas_spec.js49
-rw-r--r--spec/javascripts/vehicle_journeys/reducers/filters_spec.js8
3 files changed, 80 insertions, 4 deletions
diff --git a/spec/javascripts/time_table/actions_spec.js b/spec/javascripts/time_table/actions_spec.js
new file mode 100644
index 000000000..c628a0f57
--- /dev/null
+++ b/spec/javascripts/time_table/actions_spec.js
@@ -0,0 +1,27 @@
+var actions = require('es6_browserified/time_tables/actions')
+
+describe('actions', () => {
+ it('should create an action to update dayTypes', () => {
+ const expectedAction = {
+ type: 'UPDATE_DAY_TYPES',
+ index: 1
+ }
+ expect(actions.updateDayTypes(1)).toEqual(expectedAction)
+ })
+
+ it('should create an action to update comment', () => {
+ const expectedAction = {
+ type: 'UPDATE_COMMENT',
+ comment: 'test'
+ }
+ expect(actions.updateComment('test')).toEqual(expectedAction)
+ })
+
+ it('should create an action to update color', () => {
+ const expectedAction = {
+ type: 'UPDATE_COLOR',
+ color: '#ffffff'
+ }
+ expect(actions.updateColor('#ffffff')).toEqual(expectedAction)
+ })
+})
diff --git a/spec/javascripts/time_table/reducers/metas_spec.js b/spec/javascripts/time_table/reducers/metas_spec.js
new file mode 100644
index 000000000..e3729dc2a
--- /dev/null
+++ b/spec/javascripts/time_table/reducers/metas_spec.js
@@ -0,0 +1,49 @@
+var metasReducer = require('es6_browserified/time_tables/reducers/metas')
+
+let state = {}
+
+describe('status reducer', () => {
+ beforeEach(() => {
+ state = {
+ comment: 'test',
+ day_types: [true, true, true, true, true, true, true],
+ tags: ['t1'],
+ color: 'blue'
+ }
+ })
+
+ it('should return the initial state', () => {
+ expect(
+ metasReducer(undefined, {})
+ ).toEqual({})
+ })
+
+ it('should handle UPDATE_DAY_TYPES', () => {
+ const arr = [false, true, true, true, true, true, true]
+ expect(
+ metasReducer(state, {
+ type: 'UPDATE_DAY_TYPES',
+ index: 0
+ })
+ ).toEqual(Object.assign({}, state, {day_types: arr}))
+ })
+
+ it('should handle UPDATE_COMMENT', () => {
+ expect(
+ metasReducer(state, {
+ type: 'UPDATE_COMMENT',
+ comment: 'title'
+ })
+ ).toEqual(Object.assign({}, state, {comment: 'title'}))
+ })
+
+ it('should handle UPDATE_COLOR', () => {
+ expect(
+ metasReducer(state, {
+ type: 'UPDATE_COLOR',
+ color: '#ffffff'
+ })
+ ).toEqual(Object.assign({}, state, {color: '#ffffff'}))
+ })
+
+})
diff --git a/spec/javascripts/vehicle_journeys/reducers/filters_spec.js b/spec/javascripts/vehicle_journeys/reducers/filters_spec.js
index 84608243b..d5cdff430 100644
--- a/spec/javascripts/vehicle_journeys/reducers/filters_spec.js
+++ b/spec/javascripts/vehicle_journeys/reducers/filters_spec.js
@@ -29,7 +29,7 @@ describe('filters reducer', () => {
},
journeyPattern: {},
timetable: {},
- withoutSchedule: false,
+ withoutSchedule: true,
},
queryString: ''
}
@@ -61,7 +61,7 @@ describe('filters reducer', () => {
it('should handle TOGGLE_WITHOUT_SCHEDULE', () => {
let rslt = JSON.parse(JSON.stringify(state.query))
- rslt.withoutSchedule = true
+ rslt.withoutSchedule = false
expect(
statusReducer(state, {
type: 'TOGGLE_WITHOUT_SCHEDULE'
@@ -143,8 +143,8 @@ describe('filters reducer', () => {
).toEqual(Object.assign({}, state, {query: newQuery}))
})
- it('should handle SELECT_JP_FILTER', () => {
- let strResult = "q%5Bjourney_pattern_id_eq%5D=undefined&q%5Btime_tables_id_eq%5D=undefined&q%5Bvehicle_journey_at_stops_departure_time_gteq%5D=11%3A11&q%5Bvehicle_journey_at_stops_departure_time_lteq%5D=22%3A22"
+ it('should handle CREATE_QUERY_STRING', () => {
+ let strResult = "q%5Bjourney_pattern_id_eq%5D=undefined&q%5Btime_tables_id_eq%5D=undefined&q%5Bvehicle_journey_at_stops_departure_time_gteq%5D=11%3A11&q%5Bvehicle_journey_at_stops_departure_time_lteq%5D=22%3A22&q%5Bvehicle_journey_without_departure_time%5D=true"
expect(
statusReducer(state, {
type: 'CREATE_QUERY_STRING',