summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--package.json1
-rw-r--r--pom.xml26
-rw-r--r--test/app/MainScreenWrapperActionHelper.test.js132
-rw-r--r--test/app/configurableViews/ConfigurableViewReducer.test.js32
-rw-r--r--test/app/globalInlineMessageBar/GlobalInlineMessageBarReducer.test.js35
-rw-r--r--test/app/networking/NetworkCalls.test.js51
-rw-r--r--version.properties4
7 files changed, 248 insertions, 33 deletions
diff --git a/package.json b/package.json
index 2b8334a..ef4d259 100644
--- a/package.json
+++ b/package.json
@@ -48,6 +48,7 @@
"redux": "^3.3.1",
"redux-form": "^6.2.1",
"redux-thunk": "^2.1.0",
+ "sinon": "^7.3.1",
"topojson": "^2.2.0",
"uuid-js": "^0.7.5",
"validator": "^4.3.0",
diff --git a/pom.xml b/pom.xml
index 422b04f..725d77f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,10 +23,15 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.oparent</groupId>
+ <artifactId>oparent</artifactId>
+ <version>2.0.0</version>
+ </parent>
<groupId>org.onap.aai</groupId>
<artifactId>sparky-fe</artifactId>
<packaging>war</packaging>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.5.1-SNAPSHOT</version>
<name>aai-sparky-fe</name>
<url>http://maven.apache.org</url>
@@ -88,6 +93,14 @@
<goal>npm</goal>
</goals>
<phase>generate-resources</phase>
+ <configuration>
+ <!-- optional: The default argument is actually
+ "install", so unless you need to run some other npm command,
+ you can remove this whole <configuration> section.
+ -->
+ <arguments>install -ddd</arguments>
+ </configuration>
+
</execution>
<execution>
<id>gulp build</id>
@@ -104,15 +117,8 @@
</executions>
</plugin>
<plugin>
- <groupId>org.sonatype.plugins</groupId>
- <artifactId>nexus-staging-maven-plugin</artifactId>
- <version>1.6.7</version>
- <extensions>true</extensions>
- <configuration>
- <nexusUrl>${nexusproxy}</nexusUrl>
- <stagingProfileId>176c31dfe190a</stagingProfileId>
- <serverId>ecomp-staging</serverId>
- </configuration>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
</plugin>
</plugins>
</build>
diff --git a/test/app/MainScreenWrapperActionHelper.test.js b/test/app/MainScreenWrapperActionHelper.test.js
new file mode 100644
index 0000000..011010e
--- /dev/null
+++ b/test/app/MainScreenWrapperActionHelper.test.js
@@ -0,0 +1,132 @@
+import configureStore from 'redux-mock-store';
+import thunk from 'redux-thunk'
+import {
+ windowResize,
+ showMainMenu,
+ extensibleViewMessageCallback,
+ clearExtensibleViewData,
+ setSecondaryTitle
+} from 'app/MainScreenWrapperActionHelper';
+import {
+ getSetGlobalMessageEvent,
+ getClearGlobalMessageEvent
+} from 'app/globalInlineMessageBar/GlobalInlineMessageBarActions';
+import {
+ globalInlineMessageBarActionTypes
+} from 'app/globalInlineMessageBar/GlobalInlineMessageBarConstants';
+import {aaiActionTypes} from 'app/MainScreenWrapperConstants';
+
+const mockStore = configureStore([thunk]);
+
+describe('MainScreenWrapperActionHelper', () => {
+ let store;
+
+ beforeEach(() => {
+ store = mockStore({ tierSupportReducer: {} });
+ });
+
+ describe('windowResize', () => {
+ it('emits action', () => {
+ // Given
+ const expectedActions = [{
+ type: aaiActionTypes.AAI_WINDOW_RESIZE
+ }];
+
+ // When
+ store.dispatch(windowResize());
+
+ // Then
+ expect(store.getActions()).toEqual(expectedActions);
+ });
+ });
+
+ describe('showMainMenu', () => {
+ it('emits action with payload', () => {
+ // Given
+ const input = "testInput";
+ const expectedActions = [{
+ type: aaiActionTypes.AAI_SHOW_MENU,
+ data: {
+ showMenu: input
+ }
+ }];
+
+ // When
+ store.dispatch(showMainMenu(input));
+
+ // Then
+ expect(store.getActions()).toEqual(expectedActions);
+ });
+ });
+
+ describe('extensibleViewMessageCallback', () => {
+ const msgSeverity = "msgSeverity";
+
+ it('emits action with payload when msgText is not blank', () => {
+ // Given
+ const msgText = "msgText";
+ const expectedActions = [{
+ type: globalInlineMessageBarActionTypes.SET_GLOBAL_MESSAGE,
+ data: {
+ msgText: msgText,
+ msgSeverity: msgSeverity
+ }
+ }];
+
+ // When
+ store.dispatch(extensibleViewMessageCallback(msgText, msgSeverity));
+
+ // Then
+ expect(store.getActions()).toEqual(expectedActions);
+ });
+
+ it('emits action when msgText is blank', () => {
+ // Given
+ const msgText = "";
+ const expectedActions = [{
+ type: globalInlineMessageBarActionTypes.CLEAR_GLOBAL_MESSAGE
+
+ }];
+
+ // When
+ store.dispatch(extensibleViewMessageCallback(msgText, msgSeverity));
+
+ // Then
+ expect(store.getActions()).toEqual(expectedActions);
+ });
+ });
+
+ describe('clearExtensibleViewData', () => {
+ it('emits action with payload', () => {
+ // Given
+ const expectedActions = [{
+ type: aaiActionTypes.EXTENSIBLE_VIEW_NETWORK_CALLBACK_CLEAR_DATA,
+ data: {}
+ }];
+
+ // When
+ store.dispatch(clearExtensibleViewData());
+
+ // Then
+ expect(store.getActions()).toEqual(expectedActions);
+ });
+ });
+
+ describe('setSecondaryTitle', () => {
+ it('emits action with payload', () => {
+ // Given
+ const title = "testTitle";
+ const expectedActions = [{
+ type: aaiActionTypes.SET_SECONDARY_TITLE,
+ data: title
+ }];
+
+ // When
+ store.dispatch(setSecondaryTitle(title));
+
+ // Then
+ expect(store.getActions()).toEqual(expectedActions);
+ });
+ });
+
+});
diff --git a/test/app/configurableViews/ConfigurableViewReducer.test.js b/test/app/configurableViews/ConfigurableViewReducer.test.js
index 0c5c46e..53e8b89 100644
--- a/test/app/configurableViews/ConfigurableViewReducer.test.js
+++ b/test/app/configurableViews/ConfigurableViewReducer.test.js
@@ -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);
+ });
+});
diff --git a/test/app/globalInlineMessageBar/GlobalInlineMessageBarReducer.test.js b/test/app/globalInlineMessageBar/GlobalInlineMessageBarReducer.test.js
index 62389b4..bbcb7c1 100644
--- a/test/app/globalInlineMessageBar/GlobalInlineMessageBarReducer.test.js
+++ b/test/app/globalInlineMessageBar/GlobalInlineMessageBarReducer.test.js
@@ -1,13 +1,14 @@
-import GlobalInlineMessageBarReducer from 'app/globalInlineMessageBar/GlobalInlineMessageBarReducer.js';
+import GlobalInlineMessageBarReducer from 'app/globalInlineMessageBar/GlobalInlineMessageBarReducer';
import {
globalInlineMessageBarActionTypes
-} from 'app/globalInlineMessageBar/GlobalInlineMessageBarConstants.js';
+} from 'app/globalInlineMessageBar/GlobalInlineMessageBarConstants';
import {
MESSAGE_LEVEL_WARNING
-} from 'utils/GlobalConstants.js'
+} from 'utils/GlobalConstants'
describe('GlobalInlineMessageBarReducerTests', () => {
it('Action Type: SET_GLOBAL_MESSAGE', () => {
+ // Given
const action = {
type: globalInlineMessageBarActionTypes.SET_GLOBAL_MESSAGE,
data: {
@@ -16,7 +17,11 @@ describe('GlobalInlineMessageBarReducerTests', () => {
}
};
let state = {};
+
+ // When
state = GlobalInlineMessageBarReducer(state, action);
+
+ // Then
expect(state).toEqual({
feedbackMsgText: action.data.msgText,
feedbackMsgSeverity: action.data.msgSeverity
@@ -24,6 +29,7 @@ describe('GlobalInlineMessageBarReducerTests', () => {
});
it('Action Type: CLEAR_GLOBAL_MESSAGE', () => {
+ // Given
const action = {
type: globalInlineMessageBarActionTypes.CLEAR_GLOBAL_MESSAGE
};
@@ -31,10 +37,31 @@ describe('GlobalInlineMessageBarReducerTests', () => {
feedbackMsgText: 'some error message here',
feedbackMsgSeverity: MESSAGE_LEVEL_WARNING
};
+
+ // When
state = GlobalInlineMessageBarReducer(state, action);
+
+ // Then
expect(state).toEqual({
feedbackMsgText: '',
feedbackMsgSeverity: ''
});
});
-})
+
+ it('Action Type: unknown', () => {
+ // Given
+ const action = {
+ type: "TestUnknownType"
+ };
+ const initialState = {
+ feedbackMsgText: 'some error message here',
+ feedbackMsgSeverity: MESSAGE_LEVEL_WARNING
+ };
+
+ // When
+ const newState = GlobalInlineMessageBarReducer(initialState, action);
+
+ // Then
+ expect(newState).toEqual(initialState);
+ });
+});
diff --git a/test/app/networking/NetworkCalls.test.js b/test/app/networking/NetworkCalls.test.js
index 373fbac..a3b6176 100644
--- a/test/app/networking/NetworkCalls.test.js
+++ b/test/app/networking/NetworkCalls.test.js
@@ -90,34 +90,53 @@ describe("Network Utils", () => {
describe('#getRequest', () => {
it("should fetch any request", () => {
- const json = suite.sandbox.stub();
- const fetchPromise = Promise.resolve({json});
- global.fetch = suite.sandbox.stub();
-
- global.fetch
- .withArgs('URL', {
- credentials: 'same-origin',
- method: 'GET'
- })
- .returns(fetchPromise);
-
- NetworkCalls.getRequest("URL", "GET");
-
- return fetchPromise.then(() => {
- sinon.assert.calledOnce(json);
- });
+ // given
+ global.fetch = suite.sandbox.stub();
+ const json = suite.sandbox.stub();
+ const url = "localhost";
+
+ global.fetch
+ .withArgs(url, {
+ credentials: 'same-origin',
+ method: 'GET'
+ })
+ .returns(json);
+
+ // when
+ const request = NetworkCalls.getRequest(url, "GET");
+
+ //then
+ expect(request).toBe(json)
+ sinon.assert.calledOnce(global.fetch);
});
});
describe('#genericRequest', () => {
it('should fetch any generic request', () => {
+ // given
global.fetch = suite.sandbox.stub();
const then = suite.sandbox.stub();
fetch.returns({then});
+
+ // when
NetworkCalls.genericRequest("localhost", "/relativeUrl", "GET");
+ // then
expect(then.firstCall.args[0]({json: () => "d"})).toEqual("d");
+ sinon.assert.calledOnce(fetch);
+ });
+ it('should fetch any generic request - non relative', () => {
+ // given
+ global.fetch = suite.sandbox.stub();
+ const then = suite.sandbox.stub();
+ fetch.returns({then});
+
+ // when
+ NetworkCalls.genericRequest("localhost", false, "GET");
+
+ // then
+ expect(then.firstCall.args[0]({json: () => "d"})).toEqual("d");
sinon.assert.calledOnce(fetch);
});
});
diff --git a/version.properties b/version.properties
index 66827fd..4814eb2 100644
--- a/version.properties
+++ b/version.properties
@@ -4,8 +4,8 @@
# because they are used in Jenkins, whose plug-in doesn't support
major_version=1
-minor_version=4
-patch_version=0
+minor_version=5
+patch_version=1
base_version=${major_version}.${minor_version}.${patch_version}