Merge "Add tests to Inventory module"
[aai/sparky-fe.git] / test / app / configurableViews / ConfigurableViewReducer.test.js
1 import {
2   configurableViewsActionTypes
3 } from 'app/configurableViews/ConfigurableViewConstants.js';
4 import ConfigurableViewReducer from 'app/configurableViews/ConfigurableViewReducer.js'
5 describe('ConfigurableViewsReducerTests', () => {
6   it('Action Type: CONFIGURABLE_VIEWS_CONFIG_RECEIVED', () => {
7     const data = {
8       viewId: 'someViewId',
9       viewName: 'Some View Name',
10       viewRoute: 'some/view/route'
11     };
12     const action = {
13       type: configurableViewsActionTypes.CONFIGURABLE_VIEWS_CONFIG_RECEIVED,
14       data: data
15     };
16     let state = {};
17     state = ConfigurableViewReducer(state, action);
18     expect(state).toEqual({
19       configurableViewsConfig: data
20     });
21   });
22
23   it('Action Type: CUSTOM_COMPONENTS_RECEIVED', () => {
24     const data = {
25       componentName: 'someComponentName',
26       componentData: {
27         blah: 'blah',
28         filler: 'filler'
29       }
30     };
31     const action = {
32       type: configurableViewsActionTypes.CUSTOM_COMPONENTS_RECEIVED,
33       data: data
34     };
35     let state = {};
36     state = ConfigurableViewReducer(state, action);
37     expect(state).toEqual({
38       customComponents: data
39     });
40   });
41
42   it('Action Type: CUSTOM_ROUTES', () => {
43     const data = 'some/custom/route';
44     const action = {
45       type: configurableViewsActionTypes.CUSTOM_ROUTES,
46       data: data
47     };
48     let state = {};
49     state = ConfigurableViewReducer(state, action);
50     expect(state).toEqual({
51       customRoutes: data
52     });
53   });
54 })