X-Git-Url: https://gerrit.onap.org/r/gitweb?p=aai%2Fsparky-fe.git;a=blobdiff_plain;f=test%2Fapp%2FconfigurableViews%2FConfigurableViewReducer.test.js;fp=test%2Fapp%2FconfigurableViews%2FConfigurableViewReducer.test.js;h=0c5c46ef6e0752a57928f8b6961bb1f069a961a2;hp=0000000000000000000000000000000000000000;hb=b0f2f345cc2d1cc3812ad8a06fc1898daf5842d0;hpb=b2c7546f9027099161aeaf5791f1d0f3a52b92d2 diff --git a/test/app/configurableViews/ConfigurableViewReducer.test.js b/test/app/configurableViews/ConfigurableViewReducer.test.js new file mode 100644 index 0000000..0c5c46e --- /dev/null +++ b/test/app/configurableViews/ConfigurableViewReducer.test.js @@ -0,0 +1,54 @@ +import { + configurableViewsActionTypes +} from 'app/configurableViews/ConfigurableViewConstants.js'; +import ConfigurableViewReducer from 'app/configurableViews/ConfigurableViewReducer.js' +describe('ConfigurableViewsReducerTests', () => { + it('Action Type: CONFIGURABLE_VIEWS_CONFIG_RECEIVED', () => { + const data = { + viewId: 'someViewId', + viewName: 'Some View Name', + viewRoute: 'some/view/route' + }; + const action = { + type: configurableViewsActionTypes.CONFIGURABLE_VIEWS_CONFIG_RECEIVED, + data: data + }; + let state = {}; + state = ConfigurableViewReducer(state, action); + expect(state).toEqual({ + configurableViewsConfig: data + }); + }); + + it('Action Type: CUSTOM_COMPONENTS_RECEIVED', () => { + const data = { + componentName: 'someComponentName', + componentData: { + blah: 'blah', + filler: 'filler' + } + }; + const action = { + type: configurableViewsActionTypes.CUSTOM_COMPONENTS_RECEIVED, + data: data + }; + let state = {}; + state = ConfigurableViewReducer(state, action); + expect(state).toEqual({ + customComponents: data + }); + }); + + it('Action Type: CUSTOM_ROUTES', () => { + const data = 'some/custom/route'; + const action = { + type: configurableViewsActionTypes.CUSTOM_ROUTES, + data: data + }; + let state = {}; + state = ConfigurableViewReducer(state, action); + expect(state).toEqual({ + customRoutes: data + }); + }); +})