| Total Complexity | 6 |
| Complexity/F | 1 |
| Lines of Code | 45 |
| Function Count | 6 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import drawerReducer from '../reducers' |
||
| 2 | |||
| 3 | describe('drawer reducers', () => { |
||
| 4 | it('should return state with open drawer', function() { |
||
| 5 | const initState = { |
||
| 6 | open: false |
||
| 7 | } |
||
| 8 | const action = { |
||
| 9 | type: 'drawer/openDrawer' |
||
| 10 | } |
||
| 11 | expect(drawerReducer(initState, action)).toEqual({ |
||
| 12 | open: true |
||
| 13 | }) |
||
| 14 | }) |
||
| 15 | |||
| 16 | it('should return state with close drawer', function() { |
||
| 17 | const initState = { |
||
| 18 | open: true |
||
| 19 | } |
||
| 20 | const action = { |
||
| 21 | type: 'drawer/closeDrawer' |
||
| 22 | } |
||
| 23 | expect(drawerReducer(initState, action)).toEqual({ |
||
| 24 | open: false |
||
| 25 | }) |
||
| 26 | }) |
||
| 27 | |||
| 28 | it('should return state with unknown action type', function() { |
||
| 29 | const initState = { |
||
| 30 | open: false |
||
| 31 | } |
||
| 32 | const action = { |
||
| 33 | type: '' |
||
| 34 | } |
||
| 35 | expect(drawerReducer(initState, action)).toEqual({ |
||
| 36 | open: false |
||
| 37 | }) |
||
| 38 | }) |
||
| 39 | |||
| 40 | it('should throw error when calling reducer with nothing', function() { |
||
| 41 | expect(() => { |
||
| 42 | drawerReducer() |
||
| 43 | }).toThrow(TypeError) |
||
| 44 | }) |
||
| 45 | }) |
||
| 46 |