From 27fe29a076553c26e2c56dccaf52d2af789eae3a Mon Sep 17 00:00:00 2001 From: andrzejszukuc Date: Thu, 14 Feb 2019 13:38:12 +0100 Subject: Integration tests for MainScreenWrapperReducer Change-Id: I7e947ea2ccab8877a3b8bb01d8e6b999bee1901f Issue-ID: AAI-2143 Signed-off-by: Andrzej Szukuc --- src/app/MainScreenWrapperActionHelper.js | 14 ++++---------- src/app/contextHandler/ContextHandlerActions.js | 22 ++++++---------------- src/app/personlaization/PersonalizationActions.js | 6 ++---- 3 files changed, 12 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/app/MainScreenWrapperActionHelper.js b/src/app/MainScreenWrapperActionHelper.js index dd7450b..3477b03 100644 --- a/src/app/MainScreenWrapperActionHelper.js +++ b/src/app/MainScreenWrapperActionHelper.js @@ -74,8 +74,7 @@ function createOverlayDataFoundEvent(overlayData, paramName, curData, responseEv } function overlayViewData(dataFetchRequest, paramName, curData, responseEventKey) { - return dispatch => { - dataFetchRequest().then( + return dispatch => dataFetchRequest().then( (response) => { return response.json(); } @@ -87,8 +86,7 @@ function overlayViewData(dataFetchRequest, paramName, curData, responseEventKey) dispatch(getSetGlobalMessageEvent(ERROR_RETRIEVING_DATA, MESSAGE_LEVEL_DANGER)); dispatch(createOverlayDataFoundEvent({}, paramName, curData, responseEventKey)); }); - }; -} +}; export function overlayNetworkCallback(urlApi, postBody, paramName, curData, responseEventKey) { let dataFetchRequest = @@ -113,8 +111,7 @@ function createViewDataFoundEvent(viewData, paramName, curViewData) { } function extensibleViewData(dataFetchRequest, paramName, curViewData) { - return dispatch => { - return dataFetchRequest().then( + return dispatch => dataFetchRequest().then( (response) => { return response.json(); } @@ -127,7 +124,6 @@ function extensibleViewData(dataFetchRequest, paramName, curViewData) { dispatch(createViewDataFoundEvent({}, paramName, curViewData)); //To-do: If need to send a flag later on to the view, add a function to have the flag }); - }; } export function extensibleViewNetworkCallback(urlApi, postBody, paramName, curViewData) { @@ -136,9 +132,7 @@ export function extensibleViewNetworkCallback(urlApi, postBody, paramName, curVi () => fetchRequestObj(BASE_URL + urlApi, POST, POST_HEADER, postBody); - return dispatch => { - dispatch(extensibleViewData(dataFetchRequest, paramName, curViewData)); - }; + return dispatch => dispatch(extensibleViewData(dataFetchRequest, paramName, curViewData)); } export function extensibleViewMessageCallback(msgText, msgSeverity) { diff --git a/src/app/contextHandler/ContextHandlerActions.js b/src/app/contextHandler/ContextHandlerActions.js index f3ede6d..35091b5 100644 --- a/src/app/contextHandler/ContextHandlerActions.js +++ b/src/app/contextHandler/ContextHandlerActions.js @@ -81,8 +81,7 @@ function createSubscriptionPayloadEvent(payload) { } function fetchSubscriptionPayload(fetchRequestCallback) { - return dispatch => { - return fetchRequestCallback().then( + return dispatch => fetchRequestCallback().then( (response) => { if (response.status >= STATUS_CODE_3XX_REDIRECTION) { return Promise.reject(new Error(response.status)); @@ -100,16 +99,13 @@ function fetchSubscriptionPayload(fetchRequestCallback) { dispatch(getSetGlobalMessageEvent(SUBSCRIPTION_FAILED_MESSAGE , MESSAGE_LEVEL_WARNING)); } ); - }; } export function getSubscriptionPayload() { let externalfetchRequest = () => networkCall.getRequest(SUBSCRIPTION_PAYLOAD_URL, GET); - return dispatch => { - dispatch(fetchSubscriptionPayload(externalfetchRequest)); - }; + return dispatch => dispatch(fetchSubscriptionPayload(externalfetchRequest)); } function validateExternalParams(externalURLParams) { @@ -129,8 +125,8 @@ function createSuggestionFoundEvent(suggestion) { function fetchDataForExternalRequest(fetchRequestCallback) { - return dispatch => { - return fetchRequestCallback().then( + return dispatch => + fetchRequestCallback().then( (response) => { if (response.status === STATUS_CODE_204_NO_CONTENT || response.status >= STATUS_CODE_3XX_REDIRECTION) { return Promise.reject(new Error(response.status)); @@ -158,7 +154,6 @@ function fetchDataForExternalRequest(fetchRequestCallback) { dispatch(getSetGlobalMessageEvent(FAILED_REQUEST , MESSAGE_LEVEL_DANGER)); } ); - }; } function validateAndFetchExternalParams(externalParams) { @@ -172,17 +167,12 @@ function validateAndFetchExternalParams(externalParams) { let externalfetchRequest = () => networkCall.fetchRequestObj(EXTERNAL_REQ_ENTITY_SEARCH_URL, POST, POST_HEADER, postBody); - return dispatch => { - dispatch(fetchDataForExternalRequest(externalfetchRequest)); - }; + return dispatch => dispatch(fetchDataForExternalRequest(externalfetchRequest)); } } export function externalUrlRequest(urlParams) { let externalURLParams = getExternalParamValues(urlParams); - return dispatch => { - dispatch( - validateAndFetchExternalParams(externalURLParams)); - }; + return dispatch => dispatch(validateAndFetchExternalParams(externalURLParams)); } export function externalMessageRequest(jsonParams) { return dispatch => { diff --git a/src/app/personlaization/PersonalizationActions.js b/src/app/personlaization/PersonalizationActions.js index b10d85f..bdf54ca 100644 --- a/src/app/personlaization/PersonalizationActions.js +++ b/src/app/personlaization/PersonalizationActions.js @@ -74,7 +74,5 @@ export function getPersonalizationDetails(){ let personalizationFetchRequest = () => networkCall.getRequest(GET_PERSONALIZED_VALUES_URL, GET); - return dispatch => { - dispatch(fetchPersonalizedValues(personalizationFetchRequest)); - }; -} \ No newline at end of file + return dispatch => dispatch(fetchPersonalizedValues(personalizationFetchRequest)); +} -- cgit 1.2.3-korg