aboutsummaryrefslogtreecommitdiffstats
path: root/spec/javascripts/time_table
diff options
context:
space:
mode:
authorRobert2017-04-24 14:16:52 +0200
committerRobert2017-04-24 14:16:52 +0200
commit2d19e65fa8d8ac037c7f00a638111788b7ee002c (patch)
tree830fe41ac13743f75f2c16f41dfd1ff399b99a9b /spec/javascripts/time_table
parent5003acfc533baa824fed11cf6f82f86393b3a0f6 (diff)
parent1cbed80c913420c76ac7d3716b9d8c4bf4e14278 (diff)
downloadchouette-core-2d19e65fa8d8ac037c7f00a638111788b7ee002c.tar.bz2
conflict resolution and asset recompilation
Diffstat (limited to 'spec/javascripts/time_table')
-rw-r--r--spec/javascripts/time_table/actions_spec.js27
-rw-r--r--spec/javascripts/time_table/reducers/metas_spec.js49
2 files changed, 76 insertions, 0 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'}))
+ })
+
+})