| Total Complexity | 4 |
| Complexity/F | 1 |
| Lines of Code | 74 |
| Function Count | 4 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | /* eslint-enable describe it */ |
||
| 2 | import expect from 'expect'; |
||
| 3 | import { fromJS } from 'immutable'; |
||
| 4 | |||
| 5 | import { |
||
| 6 | REMOVE_TOOLBAR |
||
| 7 | } from './../../../../src/constants/ActionTypes'; |
||
| 8 | |||
| 9 | import |
||
| 10 | bulkaction |
||
| 11 | from './../../../../src/reducers/components/plugins/bulkaction'; |
||
| 12 | |||
| 13 | import { |
||
| 14 | generateLastUpdate, |
||
| 15 | resetLastUpdate |
||
| 16 | } from './../../../../src/util/lastUpdate'; |
||
| 17 | |||
| 18 | describe('The bulkaction reducer', () => { |
||
| 19 | beforeEach(() => resetLastUpdate()); |
||
| 20 | |||
| 21 | it('Should set toolbar as visible', () => { |
||
| 22 | |||
| 23 | const state = fromJS({ |
||
| 24 | 'test-grid': { |
||
| 25 | isRemoved: true |
||
| 26 | } |
||
| 27 | }); |
||
| 28 | |||
| 29 | const action = { |
||
| 30 | type: REMOVE_TOOLBAR, |
||
| 31 | value: false, |
||
| 32 | stateKey: 'test-grid' |
||
| 33 | }; |
||
| 34 | |||
| 35 | expect( |
||
| 36 | bulkaction(state, action) |
||
| 37 | ).toEqual( |
||
| 38 | fromJS({ |
||
| 39 | 'test-grid': { |
||
| 40 | isRemoved: false, |
||
| 41 | lastUpdate: 1 |
||
| 42 | } |
||
| 43 | }) |
||
| 44 | ); |
||
| 45 | |||
| 46 | }); |
||
| 47 | |||
| 48 | it('Should set toolbar as removed', () => { |
||
| 49 | |||
| 50 | const state = fromJS({ |
||
| 51 | 'test-grid': { |
||
| 52 | isRemoved: false |
||
| 53 | } |
||
| 54 | }); |
||
| 55 | |||
| 56 | const action = { |
||
| 57 | type: REMOVE_TOOLBAR, |
||
| 58 | value: true, |
||
| 59 | stateKey: 'test-grid' |
||
| 60 | }; |
||
| 61 | |||
| 62 | expect( |
||
| 63 | bulkaction(state, action) |
||
| 64 | ).toEqual( |
||
| 65 | fromJS({ |
||
| 66 | 'test-grid': { |
||
| 67 | isRemoved: true, |
||
| 68 | lastUpdate: 1 |
||
| 69 | } |
||
| 70 | }) |
||
| 71 | ); |
||
| 72 | |||
| 73 | }); |
||
| 74 | |||
| 75 | }); |
||
| 76 |