ConfigurableViewReducer test 13/84513/2
authorAdam Wudzinski <adam.wudzinski@nokia.com>
Mon, 8 Apr 2019 11:16:40 +0000 (13:16 +0200)
committerawudzins <adam.wudzinski@nokia.com>
Wed, 10 Apr 2019 09:19:56 +0000 (11:19 +0200)
Add test covering default route for ConfigurableViewReducer

Change-Id: I5ef339a214a1f0b75b81eb5e103c72174eb298f4
Issue-ID: AAI-1618
Signed-off-by: awudzins <adam.wudzinski@nokia.com>
test/app/configurableViews/ConfigurableViewReducer.test.js

index 0c5c46e..53e8b89 100644 (file)
@@ -4,6 +4,7 @@ import {
 import ConfigurableViewReducer from 'app/configurableViews/ConfigurableViewReducer.js'
 describe('ConfigurableViewsReducerTests', () => {
   it('Action Type: CONFIGURABLE_VIEWS_CONFIG_RECEIVED', () => {
+    // Given
     const data = {
       viewId: 'someViewId',
       viewName: 'Some View Name',
@@ -14,13 +15,18 @@ describe('ConfigurableViewsReducerTests', () => {
       data: data
     };
     let state = {};
+
+    // When
     state = ConfigurableViewReducer(state, action);
+
+    // Then
     expect(state).toEqual({
       configurableViewsConfig: data
     });
   });
 
   it('Action Type: CUSTOM_COMPONENTS_RECEIVED', () => {
+    // Given
     const data = {
       componentName: 'someComponentName',
       componentData: {
@@ -33,22 +39,46 @@ describe('ConfigurableViewsReducerTests', () => {
       data: data
     };
     let state = {};
+
+    // When
     state = ConfigurableViewReducer(state, action);
+
+    // Then
     expect(state).toEqual({
       customComponents: data
     });
   });
 
   it('Action Type: CUSTOM_ROUTES', () => {
+    // Given
     const data = 'some/custom/route';
     const action = {
       type: configurableViewsActionTypes.CUSTOM_ROUTES,
       data: data
     };
     let state = {};
+
+    // When
     state = ConfigurableViewReducer(state, action);
+
+    // Then
     expect(state).toEqual({
       customRoutes: data
     });
   });
-})
+
+  it('Action Type: unknown', () => {
+    // Given
+    const action = {
+      type: "TestUnknownType",
+      data: "TestData"
+    };
+    let state = {};
+
+    // When
+    state = ConfigurableViewReducer(state, action);
+
+    // Then
+    expect(state).toEqual(state);
+  });
+});