| Total Complexity | 4 |
| Complexity/F | 1 |
| Lines of Code | 62 |
| 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 | SET_LOADING_STATE |
||
| 7 | } from './../../../../src/constants/ActionTypes'; |
||
| 8 | |||
| 9 | import |
||
| 10 | loader |
||
| 11 | from './../../../../src/reducers/components/plugins/loader'; |
||
| 12 | |||
| 13 | import { |
||
| 14 | generateLastUpdate, |
||
| 15 | resetLastUpdate |
||
| 16 | } from './../../../../src/util/lastUpdate'; |
||
| 17 | |||
| 18 | describe('The loader reducer SET_LOADING_STATE action', () => { |
||
| 19 | beforeEach(() => resetLastUpdate()); |
||
| 20 | |||
| 21 | it('Should set loading to true', () => { |
||
| 22 | |||
| 23 | const state = fromJS({}); |
||
| 24 | |||
| 25 | const action = { |
||
| 26 | type: SET_LOADING_STATE, |
||
| 27 | stateKey: 'test-grid', |
||
| 28 | state: true |
||
| 29 | }; |
||
| 30 | |||
| 31 | expect( |
||
| 32 | loader(state, action) |
||
| 33 | ).toEqualImmutable(fromJS({ |
||
| 34 | 'test-grid': { |
||
| 35 | isLoading: true, |
||
| 36 | lastUpdate: 1 |
||
| 37 | } |
||
| 38 | })); |
||
| 39 | |||
| 40 | }); |
||
| 41 | |||
| 42 | it('Should set loading to false', () => { |
||
| 43 | |||
| 44 | const state = fromJS({}); |
||
| 45 | |||
| 46 | const action = { |
||
| 47 | type: SET_LOADING_STATE, |
||
| 48 | stateKey: 'test-grid', |
||
| 49 | state: false |
||
| 50 | }; |
||
| 51 | |||
| 52 | expect( |
||
| 53 | loader(state, action) |
||
| 54 | ).toEqualImmutable(fromJS({ |
||
| 55 | 'test-grid': { |
||
| 56 | isLoading: false, |
||
| 57 | lastUpdate: 1 |
||
| 58 | } |
||
| 59 | })); |
||
| 60 | |||
| 61 | }); |
||
| 62 | |||
| 63 | }); |