Skip to content
Snippets Groups Projects
Commit 1bf6a46a authored by Vitaly Slobodin's avatar Vitaly Slobodin :crystal_ball:
Browse files

Merge branch 'xanf-fix-extra-spinning-test-action' into 'master'

Fix missing promise handling for `testAction`

See merge request !137636



Merged-by: default avatarVitaly Slobodin <vslobodin@gitlab.com>
Approved-by: default avatarVitaly Slobodin <vslobodin@gitlab.com>
Co-authored-by: Illya Klymov's avatarIllya Klymov <iklymov@gitlab.com>
parents 6ce8e234 d3e27df4
No related branches found
No related tags found
1 merge request!137636Fix missing promise handling for `testAction`
Pipeline #1081432807 failed
Showing
with 179 additions and 161 deletions
......@@ -118,7 +118,7 @@ describe('Code review analytics mergeRequests actions', () => {
describe('setPage', () => {
it('commits SET_PAGE mutation', () => {
testAction(actions.setPage, 2, state, [{ type: types.SET_PAGE, payload: 2 }], []);
return testAction(actions.setPage, 2, state, [{ type: types.SET_PAGE, payload: 2 }], []);
});
});
});
......@@ -168,7 +168,7 @@ describe('DurationChart actions', () => {
describe('receiveDurationDataError', () => {
it("commits the 'RECEIVE_DURATION_DATA_ERROR' mutation", () => {
testAction(
return testAction(
actions.receiveDurationDataError,
{},
rootState,
......
......@@ -25,7 +25,7 @@ describe('Audit Event actions', () => {
`(
'$action should commit $type with $payload and dispatches "searchForAuditEvents"',
({ action, type, payload }) => {
testAction(
return testAction(
actions[action],
payload,
state,
......@@ -42,7 +42,9 @@ describe('Audit Event actions', () => {
it('setFilterValue action should commit to the store', () => {
const payload = [{ type: 'User', value: { data: '@root', operator: '=' } }];
testAction(actions.setFilterValue, payload, state, [{ type: types.SET_FILTER_VALUE, payload }]);
return testAction(actions.setFilterValue, payload, state, [
{ type: types.SET_FILTER_VALUE, payload },
]);
});
describe('searchForAuditEvents', () => {
......@@ -85,7 +87,7 @@ describe('Audit Event actions', () => {
});
it(`commits "${types.INITIALIZE_AUDIT_EVENTS}" with empty dates`, () => {
testAction(actions.initializeAuditEvents, null, state, [
return testAction(actions.initializeAuditEvents, null, state, [
{
type: types.INITIALIZE_AUDIT_EVENTS,
payload: {
......@@ -108,7 +110,7 @@ describe('Audit Event actions', () => {
});
it(`commits "${types.INITIALIZE_AUDIT_EVENTS}" with the query data`, () => {
testAction(actions.initializeAuditEvents, null, state, [
return testAction(actions.initializeAuditEvents, null, state, [
{
type: types.INITIALIZE_AUDIT_EVENTS,
payload: {
......
......@@ -25,7 +25,7 @@ describe('subscription actions', () => {
it('should commit the correct mutuation', () => {
const namespaceId = 1;
testAction(
return testAction(
actions.setNamespaceId,
namespaceId,
mockedState,
......@@ -54,7 +54,7 @@ describe('subscription actions', () => {
});
it('should dispatch the request and success actions', () => {
testAction(
return testAction(
actions.fetchSubscription,
{},
mockedState,
......@@ -78,7 +78,7 @@ describe('subscription actions', () => {
});
it('should dispatch the request and error actions', () => {
testAction(
return testAction(
actions.fetchSubscription,
{},
mockedState,
......@@ -91,7 +91,7 @@ describe('subscription actions', () => {
describe('requestSubscription', () => {
it('should commit the request mutation', () => {
testAction(
return testAction(
actions.requestSubscription,
{},
state,
......@@ -103,7 +103,7 @@ describe('subscription actions', () => {
describe('receiveSubscriptionSuccess', () => {
it('should commit the success mutation', () => {
testAction(
return testAction(
actions.receiveSubscriptionSuccess,
mockDataSubscription.gold,
mockedState,
......@@ -120,7 +120,7 @@ describe('subscription actions', () => {
describe('receiveSubscriptionError', () => {
it('should commit the error mutation', () => {
testAction(
return testAction(
actions.receiveSubscriptionError,
{},
mockedState,
......
......@@ -151,7 +151,7 @@ describe('setFilters', () => {
},
],
])('should commit mutation SET_FILTERS %s', (_, { filters, filterVariables }) => {
testAction(
return testAction(
actions.setFilters,
filters,
state,
......@@ -759,7 +759,7 @@ describe('setActiveItemHealthStatus', () => {
prop: 'healthStatus',
value: 'onTrack',
};
testAction(
return testAction(
actions.setActiveItemHealthStatus,
payload.value,
{ boardItems: { [mockIssue.id]: mockIssue }, activeBoardItem: mockIssue },
......@@ -793,7 +793,7 @@ describe('moveIssue', () => {
epicId: 'some-epic-id',
};
testAction({
return testAction({
action: actions.moveIssue,
payload: {
...params,
......@@ -863,7 +863,7 @@ describe('updateEpicForIssue', () => {
},
],
])(`commits UPDATE_BOARD_ITEM_BY_ID mutation %s`, (_, { payload, expectedMutations }) => {
testAction({
return testAction({
action: actions.updateEpicForIssue,
payload,
state: commonState,
......@@ -1077,7 +1077,7 @@ describe('addListNewEpic', () => {
},
});
testAction({
return testAction({
action: actions.addListNewEpic,
payload: {
epicInput: mockEpic,
......@@ -1120,7 +1120,7 @@ describe('addListNewEpic', () => {
},
});
testAction({
return testAction({
action: actions.addListNewEpic,
payload: {
epicInput: mockEpic,
......
......@@ -118,7 +118,7 @@ describe('GeoReplicable Store Actions', () => {
const data = [];
it('should not error and pass empty values to the mutations', () => {
testAction(
return testAction(
actions.fetchReplicableItems,
direction,
state,
......@@ -156,7 +156,7 @@ describe('GeoReplicable Store Actions', () => {
const data = registries.nodes;
it('should call mockGeoGqClient with no before/after variables as well as a first variable but no last variable', () => {
testAction(
return testAction(
actions.fetchReplicableItems,
direction,
state,
......@@ -185,7 +185,7 @@ describe('GeoReplicable Store Actions', () => {
const data = registries.nodes;
it('should call mockGeoGqClient with after variable but no before variable as well as a first variable but no last variable', () => {
testAction(
return testAction(
actions.fetchReplicableItems,
direction,
state,
......@@ -219,7 +219,7 @@ describe('GeoReplicable Store Actions', () => {
const data = registries.nodes;
it('should call mockGeoGqClient with before variable but no after variable as well as a last variable but no first variable', () => {
testAction(
return testAction(
actions.fetchReplicableItems,
direction,
state,
......@@ -255,7 +255,7 @@ describe('GeoReplicable Store Actions', () => {
it('should call mockGeoGqClient with all uppercase replicationState', () => {
state.statusFilter = FILTER_OPTIONS[1].value;
testAction(
return testAction(
actions.fetchReplicableItems,
direction,
state,
......@@ -334,7 +334,7 @@ describe('GeoReplicable Store Actions', () => {
describe('receiveInitiateAllReplicableActionError', () => {
it('should commit mutation RECEIVE_INITIATE_ALL_REPLICABLE_ACTION_ERROR', () => {
testAction(
return testAction(
actions.receiveInitiateAllReplicableActionError,
{ action: ACTION_TYPES.RESYNC_ALL },
state,
......@@ -357,7 +357,7 @@ describe('GeoReplicable Store Actions', () => {
});
it('should call mockGeoClient with correct parameters and success actions', () => {
testAction(
return testAction(
actions.initiateAllReplicableAction,
{ action },
state,
......@@ -387,7 +387,7 @@ describe('GeoReplicable Store Actions', () => {
});
it('should call mockGeoClient with correct parameters and error actions', () => {
testAction(
return testAction(
actions.initiateAllReplicableAction,
{ action },
state,
......@@ -466,7 +466,7 @@ describe('GeoReplicable Store Actions', () => {
});
it('should call mockGeoClient with correct parameters and success actions', () => {
testAction(
return testAction(
actions.initiateReplicableAction,
{ registryId, name, action },
state,
......@@ -498,7 +498,7 @@ describe('GeoReplicable Store Actions', () => {
});
it('should call mockGeoClient with correct parameters and error actions', () => {
testAction(
return testAction(
actions.initiateReplicableAction,
{ registryId, name, action },
state,
......
......@@ -276,11 +276,11 @@ describe('Insights store actions', () => {
it('does not mutate with no configData', () => {
state = { configData: null };
testAction(actions.setActiveTab, key, state, [], []);
return testAction(actions.setActiveTab, key, state, [], []);
});
it('does not mutate with no matching tab', () => {
testAction(actions.setActiveTab, 'invalidTab', state, [], []);
return testAction(actions.setActiveTab, 'invalidTab', state, [], []);
});
});
......
......@@ -8,13 +8,19 @@ import { HTTP_STATUS_OK } from '~/lib/utils/http_status';
describe('Issue analytics store actions', () => {
describe('setFilters', () => {
it('commits SET_FILTERS', () => {
testAction(actions.setFilters, null, null, [{ type: 'SET_FILTERS', payload: null }], []);
return testAction(
actions.setFilters,
null,
null,
[{ type: 'SET_FILTERS', payload: null }],
[],
);
});
});
describe('setLoadingState', () => {
it('commits SET_LOADING_STATE', () => {
testAction(
return testAction(
actions.setLoadingState,
true,
null,
......
......@@ -33,7 +33,7 @@ describe('Vuex members actions', () => {
describe('showDisableTwoFactorModal', () => {
it(`commits ${types.SHOW_DISABLE_TWO_FACTOR_MODAL} mutation`, () => {
const modalData = { userID: 5, name: 'John Malone' };
testAction(showDisableTwoFactorModal, modalData, state, [
return testAction(showDisableTwoFactorModal, modalData, state, [
{
type: types.SHOW_DISABLE_TWO_FACTOR_MODAL,
payload: modalData,
......@@ -44,7 +44,7 @@ describe('Vuex members actions', () => {
describe('hideDisableTwoFactorModal', () => {
it(`commits ${types.HIDE_DISABLE_TWO_FACTOR_MODAL} mutation`, () => {
testAction(hideDisableTwoFactorModal, {}, state, [
return testAction(hideDisableTwoFactorModal, {}, state, [
{
type: types.HIDE_DISABLE_TWO_FACTOR_MODAL,
},
......@@ -105,7 +105,7 @@ describe('Vuex members actions', () => {
describe('showLdapOverrideConfirmationModal', () => {
it(`commits ${types.SHOW_LDAP_OVERRIDE_CONFIRMATION_MODAL} mutation`, () => {
testAction(showLdapOverrideConfirmationModal, member, state, [
return testAction(showLdapOverrideConfirmationModal, member, state, [
{
type: types.SHOW_LDAP_OVERRIDE_CONFIRMATION_MODAL,
payload: member,
......@@ -116,7 +116,7 @@ describe('Vuex members actions', () => {
describe('hideLdapOverrideConfirmationModal', () => {
it(`commits ${types.HIDE_LDAP_OVERRIDE_CONFIRMATION_MODAL} mutation`, () => {
testAction(hideLdapOverrideConfirmationModal, {}, state, [
return testAction(hideLdapOverrideConfirmationModal, {}, state, [
{
type: types.HIDE_LDAP_OVERRIDE_CONFIRMATION_MODAL,
},
......
......@@ -54,7 +54,7 @@ describe('RelatedItemTree', () => {
describe('setInitialConfig', () => {
it('should set initial config on state', () => {
testAction(
return testAction(
actions.setInitialConfig,
mockInitialConfig,
{},
......@@ -66,7 +66,7 @@ describe('RelatedItemTree', () => {
describe('setInitialParentItem', () => {
it('should set initial parentItem on state', () => {
testAction(
return testAction(
actions.setInitialParentItem,
mockParentItem,
{},
......@@ -78,7 +78,7 @@ describe('RelatedItemTree', () => {
describe('setChildrenCount', () => {
it('should set initial descendantCounts on state', () => {
testAction(
return testAction(
actions.setChildrenCount,
mockParentItem.descendantCounts,
{},
......@@ -89,7 +89,7 @@ describe('RelatedItemTree', () => {
it('should persist non overwritten descendantCounts state', () => {
const descendantCounts = { openedEpics: 9 };
testAction(
return testAction(
actions.setChildrenCount,
descendantCounts,
{ descendantCounts: mockParentItem.descendantCounts },
......@@ -110,7 +110,7 @@ describe('RelatedItemTree', () => {
const mockIssuesWithType = mockIssues.map((item) => ({ ...item, type: ChildType.Issue }));
it('should update openedEpics, by incrementing it', () => {
testAction(
return testAction(
actions.updateChildrenCount,
{ item: mockEpicsWithType[0], isRemoved: false },
{ descendantCounts: mockParentItem.descendantCounts },
......@@ -125,7 +125,7 @@ describe('RelatedItemTree', () => {
});
it('should update openedIssues, by incrementing it', () => {
testAction(
return testAction(
actions.updateChildrenCount,
{ item: mockIssuesWithType[0], isRemoved: false },
{ descendantCounts: mockParentItem.descendantCounts },
......@@ -140,7 +140,7 @@ describe('RelatedItemTree', () => {
});
it('should update openedEpics, by decrementing it', () => {
testAction(
return testAction(
actions.updateChildrenCount,
{ item: mockEpicsWithType[0], isRemoved: true },
{ descendantCounts: mockParentItem.descendantCounts },
......@@ -155,7 +155,7 @@ describe('RelatedItemTree', () => {
});
it('should update openedIssues, by decrementing it', () => {
testAction(
return testAction(
actions.updateChildrenCount,
{ item: mockIssuesWithType[0], isRemoved: true },
{ descendantCounts: mockParentItem.descendantCounts },
......@@ -172,13 +172,19 @@ describe('RelatedItemTree', () => {
describe('expandItem', () => {
it('should set `itemExpanded` to true on state.childrenFlags', () => {
testAction(actions.expandItem, {}, {}, [{ type: types.EXPAND_ITEM, payload: {} }], []);
return testAction(
actions.expandItem,
{},
{},
[{ type: types.EXPAND_ITEM, payload: {} }],
[],
);
});
});
describe('collapseItem', () => {
it('should set `itemExpanded` to false on state.childrenFlags', () => {
testAction(
return testAction(
actions.collapseItem,
{},
{},
......@@ -197,7 +203,7 @@ describe('RelatedItemTree', () => {
};
it('should set provided `children` values on state.children with provided parentItem.reference key', () => {
testAction(
return testAction(
actions.setItemChildren,
mockPayload,
{},
......@@ -214,7 +220,7 @@ describe('RelatedItemTree', () => {
it('should set provided `children` values on state.children with provided parentItem.reference key and also dispatch action `expandItem` when isSubItem param is true', () => {
mockPayload.isSubItem = true;
testAction(
return testAction(
actions.setItemChildren,
mockPayload,
{},
......@@ -236,7 +242,7 @@ describe('RelatedItemTree', () => {
describe('setItemChildrenFlags', () => {
it('should set `state.childrenFlags` for every item in provided children param', () => {
testAction(
return testAction(
actions.setItemChildrenFlags,
{ children: [{ reference: '&1' }] },
{},
......@@ -250,7 +256,7 @@ describe('RelatedItemTree', () => {
it('should set `epicEndCursor` and `hasMoreEpics` to `state.childrenFlags`', () => {
const { pageInfo } = mockQueryResponse.data.group.epic.children;
testAction(
return testAction(
actions.setEpicPageInfo,
{ parentItem: mockParentItem, pageInfo },
{},
......@@ -269,7 +275,7 @@ describe('RelatedItemTree', () => {
it('should set `issueEndCursor` and `hasMoreIssues` to `state.childrenFlags`', () => {
const { pageInfo } = mockQueryResponse.data.group.epic.issues;
testAction(
return testAction(
actions.setIssuePageInfo,
{ parentItem: mockParentItem, pageInfo },
{},
......@@ -287,7 +293,7 @@ describe('RelatedItemTree', () => {
describe('setWeightSum', () => {
it('set weightSum', () => {
const descendantWeightSum = mockQueryResponse.data.group.epic;
testAction(
return testAction(
actions.setWeightSum,
descendantWeightSum,
{},
......@@ -304,7 +310,7 @@ describe('RelatedItemTree', () => {
describe('requestItems', () => {
it('should set `state.itemsFetchInProgress` to true', () => {
testAction(
return testAction(
actions.requestItems,
{},
{},
......@@ -316,7 +322,7 @@ describe('RelatedItemTree', () => {
describe('receiveItemsSuccess', () => {
it('should set `state.itemsFetchInProgress` to false', () => {
testAction(
return testAction(
actions.receiveItemsSuccess,
{},
{},
......@@ -328,7 +334,7 @@ describe('RelatedItemTree', () => {
describe('receiveItemsFailure', () => {
it('should set `state.itemsFetchInProgress` to false', () => {
testAction(
return testAction(
actions.receiveItemsFailure,
{},
{},
......@@ -370,7 +376,7 @@ describe('RelatedItemTree', () => {
healthStatus,
} = mockQueryResponse.data.group.epic;
testAction(
return testAction(
actions.fetchItems,
{ parentItem: mockParentItem, isSubItem: false },
{},
......@@ -455,7 +461,7 @@ describe('RelatedItemTree', () => {
issues: { pageInfo: issuesPageInfo },
} = mockQueryResponse.data.group.epic;
testAction(
return testAction(
actions.fetchItems,
{ parentItem: mockParentItem, isSubItem: true },
{},
......@@ -513,7 +519,7 @@ describe('RelatedItemTree', () => {
it('should dispatch `receiveItemsFailure` on request failure', () => {
jest.spyOn(epicUtils.gqClient, 'query').mockReturnValue(Promise.reject());
testAction(
return testAction(
actions.fetchItems,
{ parentItem: mockParentItem, isSubItem: false },
{},
......@@ -562,7 +568,7 @@ describe('RelatedItemTree', () => {
const epicPageInfo = mockQueryResponse.data.group.epic.children.pageInfo;
const issuesPageInfo = mockQueryResponse.data.group.epic.issues.pageInfo;
testAction(
return testAction(
actions.fetchNextPageItems,
{ parentItem: mockParentItem, isSubItem: false },
{ childrenFlags: { 'gitlab-org&1': {} } },
......@@ -605,7 +611,7 @@ describe('RelatedItemTree', () => {
it('should dispatch `receiveNextPageItemsFailure` on request failure', () => {
jest.spyOn(epicUtils.gqClient, 'query').mockReturnValue(Promise.reject());
testAction(
return testAction(
actions.fetchNextPageItems,
{ parentItem: mockParentItem, isSubItem: false },
{ childrenFlags: { 'gitlab-org&1': {} } },
......@@ -634,7 +640,7 @@ describe('RelatedItemTree', () => {
itemExpanded: false,
};
testAction(
return testAction(
actions.toggleItem,
data,
state,
......@@ -654,7 +660,7 @@ describe('RelatedItemTree', () => {
};
state.children[data.parentItem.reference] = ['foo'];
testAction(
return testAction(
actions.toggleItem,
data,
state,
......@@ -673,7 +679,7 @@ describe('RelatedItemTree', () => {
itemExpanded: true,
};
testAction(
return testAction(
actions.toggleItem,
data,
state,
......@@ -690,7 +696,7 @@ describe('RelatedItemTree', () => {
describe('setRemoveItemModalProps', () => {
it('should set values on `state.removeItemModalProps` for initializing modal', () => {
testAction(
return testAction(
actions.setRemoveItemModalProps,
{},
{},
......@@ -702,7 +708,7 @@ describe('RelatedItemTree', () => {
describe('requestRemoveItem', () => {
it('should set `state.childrenFlags[ref].itemRemoveInProgress` to true', () => {
testAction(
return testAction(
actions.requestRemoveItem,
{},
{},
......@@ -714,7 +720,7 @@ describe('RelatedItemTree', () => {
describe('receiveRemoveItemSuccess', () => {
it('should set `state.childrenFlags[ref].itemRemoveInProgress` to false', () => {
testAction(
return testAction(
actions.receiveRemoveItemSuccess,
{},
{},
......@@ -726,7 +732,7 @@ describe('RelatedItemTree', () => {
describe('receiveRemoveItemFailure', () => {
it('should set `state.childrenFlags[ref].itemRemoveInProgress` to false', () => {
testAction(
return testAction(
actions.receiveRemoveItemFailure,
{ item: { type: ChildType.Epic } },
{},
......@@ -775,7 +781,7 @@ describe('RelatedItemTree', () => {
it('should dispatch `requestRemoveItem` and `receiveRemoveItemSuccess` actions on request success', () => {
mock.onDelete(data.item.relationPath).replyOnce(HTTP_STATUS_OK, {});
testAction(
return testAction(
actions.removeItem,
{ ...data },
state,
......@@ -800,7 +806,7 @@ describe('RelatedItemTree', () => {
it('should dispatch `requestRemoveItem` and `receiveRemoveItemFailure` actions on request failure', () => {
mock.onDelete(data.item.relationPath).replyOnce(HTTP_STATUS_INTERNAL_SERVER_ERROR, {});
testAction(
return testAction(
actions.removeItem,
{ ...data },
state,
......@@ -821,7 +827,7 @@ describe('RelatedItemTree', () => {
describe('toggleAddItemForm', () => {
it('should set `state.showAddItemForm` to true', () => {
testAction(
return testAction(
actions.toggleAddItemForm,
{},
{},
......@@ -833,7 +839,7 @@ describe('RelatedItemTree', () => {
describe('toggleCreateEpicForm', () => {
it('should set `state.showCreateEpicForm` to true', () => {
testAction(
return testAction(
actions.toggleCreateEpicForm,
{},
{},
......@@ -845,7 +851,7 @@ describe('RelatedItemTree', () => {
describe('toggleCreateIssueForm', () => {
it('should set `state.showCreateIssueForm` to true and `state.showAddItemForm` to false', () => {
testAction(
return testAction(
actions.toggleCreateIssueForm,
{},
{},
......@@ -857,7 +863,7 @@ describe('RelatedItemTree', () => {
describe('setPendingReferences', () => {
it('should set param value to `state.pendingReference`', () => {
testAction(
return testAction(
actions.setPendingReferences,
{},
{},
......@@ -869,7 +875,7 @@ describe('RelatedItemTree', () => {
describe('addPendingReferences', () => {
it('should add param value to `state.pendingReference`', () => {
testAction(
return testAction(
actions.addPendingReferences,
{},
{},
......@@ -881,7 +887,7 @@ describe('RelatedItemTree', () => {
describe('removePendingReference', () => {
it('should remove param value to `state.pendingReference`', () => {
testAction(
return testAction(
actions.removePendingReference,
{},
{},
......@@ -893,7 +899,7 @@ describe('RelatedItemTree', () => {
describe('setItemInputValue', () => {
it('should set param value to `state.itemInputValue`', () => {
testAction(
return testAction(
actions.setItemInputValue,
{},
{},
......@@ -905,7 +911,7 @@ describe('RelatedItemTree', () => {
describe('requestAddItem', () => {
it('should set `state.itemAddInProgress` to true', () => {
testAction(actions.requestAddItem, {}, {}, [{ type: types.REQUEST_ADD_ITEM }], []);
return testAction(actions.requestAddItem, {}, {}, [{ type: types.REQUEST_ADD_ITEM }], []);
});
});
......@@ -920,7 +926,7 @@ describe('RelatedItemTree', () => {
userPermissions: { canAdmin: undefined },
}));
testAction(
return testAction(
actions.receiveAddItemSuccess,
{ rawItems: mockEpicsWithoutPerm },
state,
......@@ -957,7 +963,7 @@ describe('RelatedItemTree', () => {
describe('receiveAddItemFailure', () => {
it('should set `state.itemAddInProgress` to false', () => {
testAction(
return testAction(
actions.receiveAddItemFailure,
{
itemAddFailureType: itemAddFailureTypesMap.NOT_FOUND,
......@@ -978,7 +984,7 @@ describe('RelatedItemTree', () => {
});
it('should set `state.itemAddInProgress` to false, no payload', () => {
testAction(
return testAction(
actions.receiveAddItemFailure,
undefined,
{},
......@@ -1013,7 +1019,7 @@ describe('RelatedItemTree', () => {
mock.onPost(state.epicsEndpoint).replyOnce(HTTP_STATUS_OK, { issuables: [mockEpic1] });
testAction(
return testAction(
actions.addItem,
{},
state,
......@@ -1060,7 +1066,7 @@ describe('RelatedItemTree', () => {
mock.onPost(state.epicsEndpoint).replyOnce(HTTP_STATUS_INTERNAL_SERVER_ERROR, {});
testAction(
return testAction(
actions.addItem,
{},
state,
......@@ -1082,7 +1088,13 @@ describe('RelatedItemTree', () => {
describe('requestCreateItem', () => {
it('should set `state.itemCreateInProgress` to true', () => {
testAction(actions.requestCreateItem, {}, {}, [{ type: types.REQUEST_CREATE_ITEM }], []);
return testAction(
actions.requestCreateItem,
{},
{},
[{ type: types.REQUEST_CREATE_ITEM }],
[],
);
});
});
......@@ -1100,7 +1112,7 @@ describe('RelatedItemTree', () => {
state.issuableType = TYPE_EPIC;
state.isEpic = true;
testAction(
return testAction(
actions.receiveCreateItemSuccess,
{ rawItem: mockEpic1 },
state,
......@@ -1130,7 +1142,7 @@ describe('RelatedItemTree', () => {
describe('receiveCreateItemFailure', () => {
it('should set `state.itemCreateInProgress` to false', () => {
testAction(
return testAction(
actions.receiveCreateItemFailure,
{},
{},
......@@ -1546,7 +1558,7 @@ describe('RelatedItemTree', () => {
oldIndex: 0,
};
testAction(
return testAction(
actions.moveItem,
payload,
state,
......@@ -1815,7 +1827,7 @@ describe('RelatedItemTree', () => {
describe('setDefaultProjectForIssueCreation', () => {
it('should set defaultProjectForIssueCreation on state', () => {
testAction(
return testAction(
actions.setDefaultProjectForIssueCreation,
mockDefaultProjectForIssueCreation,
{},
......
......@@ -316,7 +316,7 @@ describe('Roadmap Vuex Actions', () => {
describe('initItemChildrenFlags', () => {
it('should set `state.childrenFlags` for every item in provided children param', () => {
testAction(
return testAction(
actions.initItemChildrenFlags,
{ children: [{ id: '1' }] },
{},
......@@ -329,7 +329,7 @@ describe('Roadmap Vuex Actions', () => {
describe('expandEpic', () => {
const parentItemId = '41';
it('should set `itemExpanded` to true on state.childrenFlags', () => {
testAction(
return testAction(
actions.expandEpic,
{ parentItemId },
{},
......@@ -342,7 +342,7 @@ describe('Roadmap Vuex Actions', () => {
describe('collapseEpic', () => {
const parentItemId = '41';
it('should set `itemExpanded` to false on state.childrenFlags', () => {
testAction(
return testAction(
actions.collapseEpic,
{ parentItemId },
{},
......@@ -449,7 +449,7 @@ describe('Roadmap Vuex Actions', () => {
itemExpanded: false,
};
testAction(
return testAction(
actions.toggleEpic,
{ parentItem },
state,
......@@ -472,7 +472,7 @@ describe('Roadmap Vuex Actions', () => {
};
state.childrenEpics[parentItem.id] = ['foo'];
testAction(
return testAction(
actions.toggleEpic,
{ parentItem },
state,
......@@ -491,7 +491,7 @@ describe('Roadmap Vuex Actions', () => {
itemExpanded: true,
};
testAction(
return testAction(
actions.toggleEpic,
{ parentItem },
state,
......
......@@ -36,7 +36,7 @@ describe('Status Page actions', () => {
${types.SET_ACCESS_KEY_ID} | ${'setStatusPageAccessKey'} | ${'key-id'} | ${'awsAccessKey'}
${types.SET_SECRET_ACCESS_KEY} | ${'setStatusPageSecretAccessKey'} | ${'secret'} | ${'awsSecretKey'}
`('$action will commit $mutation with $value', ({ mutation, action, value, key }) => {
testAction(
return testAction(
actions[action],
{ [key]: value },
null,
......@@ -53,7 +53,7 @@ describe('Status Page actions', () => {
describe('updateStatusPageSettings', () => {
it('should handle successful status update', () => {
mock.onPatch().reply(HTTP_STATUS_OK, {});
testAction(
return testAction(
actions.updateStatusPageSettings,
null,
state,
......@@ -73,7 +73,7 @@ describe('Status Page actions', () => {
it('should handle unsuccessful status update', () => {
mock.onPatch().reply(HTTP_STATUS_BAD_REQUEST, {});
testAction(
return testAction(
actions.updateStatusPageSettings,
null,
state,
......
......@@ -48,8 +48,8 @@ describe('Usage Quotas Seats actions', () => {
});
});
it('passes correct arguments to Api call', () => {
testAction({
it('passes correct arguments to Api call', async () => {
await testAction({
action: actions.fetchBillableMembersList,
payload,
state,
......@@ -65,7 +65,7 @@ describe('Usage Quotas Seats actions', () => {
describe('on success', () => {
it('should dispatch the request and success actions', () => {
testAction({
return testAction({
action: actions.fetchBillableMembersList,
state,
expectedActions: [
......@@ -83,7 +83,7 @@ describe('Usage Quotas Seats actions', () => {
it('should dispatch the request and error actions', () => {
GroupsApi.fetchBillableGroupMembersList.mockRejectedValue();
testAction({
return testAction({
action: actions.fetchBillableMembersList,
state,
expectedActions: [{ type: 'receiveBillableMembersListError' }],
......@@ -95,7 +95,7 @@ describe('Usage Quotas Seats actions', () => {
describe('receiveBillableMembersListSuccess', () => {
it('should commit the success mutation', () => {
testAction({
return testAction({
action: actions.receiveBillableMembersListSuccess,
payload: mockDataSeats,
state,
......@@ -124,8 +124,8 @@ describe('Usage Quotas Seats actions', () => {
Api.userSubscription.mockResolvedValue({ data: mockUserSubscription });
});
it('passes correct arguments to Api call', () => {
testAction({
it('passes correct arguments to Api call', async () => {
await testAction({
action: actions.fetchGitlabSubscription,
state,
expectedMutations: expect.anything(),
......@@ -137,7 +137,7 @@ describe('Usage Quotas Seats actions', () => {
describe('on success', () => {
it('should dispatch the request and success actions', () => {
testAction({
return testAction({
action: actions.fetchGitlabSubscription,
state,
expectedActions: [
......@@ -155,7 +155,7 @@ describe('Usage Quotas Seats actions', () => {
it('should dispatch the request and error actions', () => {
Api.userSubscription.mockRejectedValue();
testAction({
return testAction({
action: actions.fetchGitlabSubscription,
state,
expectedActions: [{ type: 'receiveGitlabSubscriptionError' }],
......@@ -167,7 +167,7 @@ describe('Usage Quotas Seats actions', () => {
describe('receiveGitlabSubscriptionSuccess', () => {
it('should commit the success mutation', () => {
testAction({
return testAction({
action: actions.receiveGitlabSubscriptionSuccess,
payload: mockDataSeats,
state,
......
......@@ -141,7 +141,7 @@ describe('Project Value Stream Analytics actions', () => {
describe('without a selected stage', () => {
it('will select the first stage from the value stream', () => {
const [firstStage] = allowedStages;
testAction({
return testAction({
action: actions.setInitialStage,
state,
payload: null,
......@@ -154,7 +154,7 @@ describe('Project Value Stream Analytics actions', () => {
describe('with no value stream stages available', () => {
it('will return SET_NO_ACCESS_ERROR', () => {
state = { ...state, stages: [] };
testAction({
return testAction({
action: actions.setInitialStage,
state,
payload: null,
......@@ -299,25 +299,23 @@ describe('Project Value Stream Analytics actions', () => {
name: 'mock default',
};
const mockValueStreams = [mockValueStream, selectedValueStream];
it('with data, will set the first value stream', () => {
it('with data, will set the first value stream', () =>
testAction({
action: actions.receiveValueStreamsSuccess,
state,
payload: mockValueStreams,
expectedMutations: [{ type: 'RECEIVE_VALUE_STREAMS_SUCCESS', payload: mockValueStreams }],
expectedActions: [{ type: 'setSelectedValueStream', payload: mockValueStream }],
});
});
}));
it('without data, will set the default value stream', () => {
it('without data, will set the default value stream', () =>
testAction({
action: actions.receiveValueStreamsSuccess,
state,
payload: [],
expectedMutations: [{ type: 'RECEIVE_VALUE_STREAMS_SUCCESS', payload: [] }],
expectedActions: [{ type: 'setSelectedValueStream', payload: selectedValueStream }],
});
});
}));
});
describe('fetchValueStreamStages', () => {
......
......@@ -165,7 +165,7 @@ describe('setFilters', () => {
issuableType: TYPE_ISSUE,
};
testAction(
return testAction(
actions.setFilters,
filters,
state,
......@@ -441,7 +441,7 @@ describe('fetchMilestones', () => {
describe('createList', () => {
it('should dispatch createIssueList action', () => {
testAction({
return testAction({
action: actions.createList,
payload: { backlog: true },
expectedActions: [{ type: 'createIssueList', payload: { backlog: true } }],
......@@ -560,7 +560,7 @@ describe('addList', () => {
};
it('should commit RECEIVE_ADD_LIST_SUCCESS mutation and dispatch fetchItemsForList action', () => {
testAction({
return testAction({
action: actions.addList,
payload: mockLists[1],
state: { ...getters },
......@@ -1007,7 +1007,7 @@ describe('moveItem', () => {
it('should dispatch moveIssue action with payload', () => {
const payload = { mock: 'payload' };
testAction({
return testAction({
action: actions.moveItem,
payload,
expectedActions: [{ type: 'moveIssue', payload }],
......@@ -1017,7 +1017,7 @@ describe('moveItem', () => {
describe('moveIssue', () => {
it('should dispatch a correct set of actions', () => {
testAction({
return testAction({
action: actions.moveIssue,
payload: mockMoveIssueParams,
state: mockMoveState,
......@@ -1092,7 +1092,7 @@ describe('moveIssueCard and undoMoveIssueCard', () => {
});
it('moveIssueCard commits a correct set of actions', () => {
testAction({
return testAction({
action: actions.moveIssueCard,
state,
payload: getMoveData(state, params),
......@@ -1101,7 +1101,7 @@ describe('moveIssueCard and undoMoveIssueCard', () => {
});
it('undoMoveIssueCard commits a correct set of actions', () => {
testAction({
return testAction({
action: actions.undoMoveIssueCard,
state,
payload: getMoveData(state, params),
......@@ -1169,7 +1169,7 @@ describe('moveIssueCard and undoMoveIssueCard', () => {
});
it('moveIssueCard commits a correct set of actions', () => {
testAction({
return testAction({
action: actions.moveIssueCard,
state,
payload: getMoveData(state, params),
......@@ -1178,7 +1178,7 @@ describe('moveIssueCard and undoMoveIssueCard', () => {
});
it('undoMoveIssueCard commits a correct set of actions', () => {
testAction({
return testAction({
action: actions.undoMoveIssueCard,
state,
payload: getMoveData(state, params),
......@@ -1244,7 +1244,7 @@ describe('moveIssueCard and undoMoveIssueCard', () => {
});
it('moveIssueCard commits a correct set of actions', () => {
testAction({
return testAction({
action: actions.moveIssueCard,
state,
payload: getMoveData(state, params),
......@@ -1253,7 +1253,7 @@ describe('moveIssueCard and undoMoveIssueCard', () => {
});
it('undoMoveIssueCard commits a correct set of actions', () => {
testAction({
return testAction({
action: actions.undoMoveIssueCard,
state,
payload: getMoveData(state, params),
......@@ -1298,7 +1298,7 @@ describe('updateMovedIssueCard', () => {
])(
'should commit UPDATE_BOARD_ITEM with a correctly updated issue data when %s',
(_, { state, moveData, updatedIssue }) => {
testAction({
return testAction({
action: actions.updateMovedIssue,
payload: moveData,
state,
......@@ -1363,7 +1363,7 @@ describe('updateIssueOrder', () => {
},
});
testAction(
return testAction(
actions.updateIssueOrder,
{ moveData },
state,
......@@ -1395,7 +1395,7 @@ describe('updateIssueOrder', () => {
},
});
testAction(
return testAction(
actions.updateIssueOrder,
{ moveData },
state,
......@@ -1448,7 +1448,7 @@ describe('addListItem', () => {
inProgress: true,
};
testAction(
return testAction(
actions.addListItem,
payload,
{},
......@@ -1475,7 +1475,7 @@ describe('addListItem', () => {
position: 0,
};
testAction(
return testAction(
actions.addListItem,
payload,
{},
......@@ -1503,7 +1503,7 @@ describe('removeListItem', () => {
itemId: mockIssue.id,
};
testAction(actions.removeListItem, payload, {}, [
return testAction(actions.removeListItem, payload, {}, [
{ type: types.REMOVE_BOARD_ITEM_FROM_LIST, payload },
{ type: types.REMOVE_BOARD_ITEM, payload: mockIssue.id },
]);
......@@ -1608,7 +1608,7 @@ describe('addListNewIssue', () => {
},
});
testAction({
return testAction({
action: actions.addListNewIssue,
payload: {
issueInput: mockIssue,
......@@ -1651,7 +1651,7 @@ describe('addListNewIssue', () => {
},
});
testAction({
return testAction({
action: actions.addListNewIssue,
payload: {
issueInput: mockIssue,
......@@ -1700,7 +1700,7 @@ describe('setActiveIssueLabels', () => {
value: labels,
};
testAction(
return testAction(
actions.setActiveIssueLabels,
input,
{ ...state, ...getters },
......@@ -1721,7 +1721,7 @@ describe('setActiveIssueLabels', () => {
value: [labels[1]],
};
testAction(
return testAction(
actions.setActiveIssueLabels,
{ ...input, removeLabelIds: [getIdFromGraphQLId(labels[0].id)] },
{ ...state, ...getters },
......@@ -1962,7 +1962,7 @@ describe('toggleBoardItemMultiSelection', () => {
const boardItem2 = mockIssue2;
it('should commit mutation ADD_BOARD_ITEM_TO_SELECTION if item is not on selection state', () => {
testAction(
return testAction(
actions.toggleBoardItemMultiSelection,
boardItem,
{ selectedBoardItems: [] },
......@@ -1977,7 +1977,7 @@ describe('toggleBoardItemMultiSelection', () => {
});
it('should commit mutation REMOVE_BOARD_ITEM_FROM_SELECTION if item is on selection state', () => {
testAction(
return testAction(
actions.toggleBoardItemMultiSelection,
boardItem,
{ selectedBoardItems: [mockIssue] },
......@@ -1992,7 +1992,7 @@ describe('toggleBoardItemMultiSelection', () => {
});
it('should additionally commit mutation ADD_BOARD_ITEM_TO_SELECTION for active issue and dispatch unsetActiveId', () => {
testAction(
return testAction(
actions.toggleBoardItemMultiSelection,
boardItem2,
{ activeId: mockActiveIssue.id, activeBoardItem: mockActiveIssue, selectedBoardItems: [] },
......@@ -2013,7 +2013,7 @@ describe('toggleBoardItemMultiSelection', () => {
describe('resetBoardItemMultiSelection', () => {
it('should commit mutation RESET_BOARD_ITEM_SELECTION', () => {
testAction({
return testAction({
action: actions.resetBoardItemMultiSelection,
state: { selectedBoardItems: [mockIssue] },
expectedMutations: [
......@@ -2027,7 +2027,7 @@ describe('resetBoardItemMultiSelection', () => {
describe('toggleBoardItem', () => {
it('should dispatch resetBoardItemMultiSelection and unsetActiveId when boardItem is the active item', () => {
testAction({
return testAction({
action: actions.toggleBoardItem,
payload: { boardItem: mockIssue },
state: {
......@@ -2038,7 +2038,7 @@ describe('toggleBoardItem', () => {
});
it('should dispatch resetBoardItemMultiSelection and setActiveId when boardItem is not the active item', () => {
testAction({
return testAction({
action: actions.toggleBoardItem,
payload: { boardItem: mockIssue },
state: {
......@@ -2054,7 +2054,7 @@ describe('toggleBoardItem', () => {
describe('setError', () => {
it('should commit mutation SET_ERROR', () => {
testAction({
return testAction({
action: actions.setError,
payload: { message: 'mayday' },
expectedMutations: [
......@@ -2085,7 +2085,7 @@ describe('setError', () => {
describe('unsetError', () => {
it('should commit mutation SET_ERROR with undefined as payload', () => {
testAction({
return testAction({
action: actions.unsetError,
expectedMutations: [
{
......
......@@ -36,7 +36,7 @@ describe('deploy freeze store actions', () => {
describe('setSelectedFreezePeriod', () => {
it('commits SET_SELECTED_TIMEZONE mutation', () => {
testAction(
return testAction(
actions.setFreezePeriod,
{
id: 3,
......@@ -69,7 +69,7 @@ describe('deploy freeze store actions', () => {
describe('setSelectedTimezone', () => {
it('commits SET_SELECTED_TIMEZONE mutation', () => {
testAction(actions.setSelectedTimezone, {}, {}, [
return testAction(actions.setSelectedTimezone, {}, {}, [
{
payload: {},
type: types.SET_SELECTED_TIMEZONE,
......@@ -80,7 +80,7 @@ describe('deploy freeze store actions', () => {
describe('setFreezeStartCron', () => {
it('commits SET_FREEZE_START_CRON mutation', () => {
testAction(actions.setFreezeStartCron, {}, {}, [
return testAction(actions.setFreezeStartCron, {}, {}, [
{
type: types.SET_FREEZE_START_CRON,
},
......@@ -90,7 +90,7 @@ describe('deploy freeze store actions', () => {
describe('setFreezeEndCron', () => {
it('commits SET_FREEZE_END_CRON mutation', () => {
testAction(actions.setFreezeEndCron, {}, {}, [
return testAction(actions.setFreezeEndCron, {}, {}, [
{
type: types.SET_FREEZE_END_CRON,
},
......
......@@ -631,7 +631,7 @@ describe('DiffsStoreActions', () => {
describe('prefetchFileNeighbors', () => {
it('dispatches two requests to prefetch the next/previous files', () => {
testAction(
return testAction(
diffActions.prefetchFileNeighbors,
{},
{
......
......@@ -57,7 +57,7 @@ describe('error tracking actions', () => {
describe('restartPolling', () => {
it('should restart polling', () => {
testAction(
return testAction(
actions.restartPolling,
{},
{},
......@@ -74,7 +74,7 @@ describe('error tracking actions', () => {
it('should search by query', () => {
const query = 'search';
testAction(
return testAction(
actions.searchByQuery,
query,
{},
......@@ -92,7 +92,7 @@ describe('error tracking actions', () => {
it('should search errors by status', () => {
const status = 'ignored';
testAction(
return testAction(
actions.filterByStatus,
status,
{},
......@@ -106,7 +106,7 @@ describe('error tracking actions', () => {
it('should search by query', () => {
const field = 'frequency';
testAction(
return testAction(
actions.sortByField,
field,
{},
......@@ -123,7 +123,7 @@ describe('error tracking actions', () => {
it('should set search endpoint', () => {
const endpoint = 'https://sentry.io';
testAction(
return testAction(
actions.setEndpoint,
{ endpoint },
{},
......@@ -136,7 +136,7 @@ describe('error tracking actions', () => {
describe('fetchPaginatedResults', () => {
it('should start polling the selected page cursor', () => {
const cursor = '1576637570000:1:1';
testAction(
return testAction(
actions.fetchPaginatedResults,
cursor,
{},
......
......@@ -8,7 +8,7 @@ describe('~/ide/stores/modules/editor/actions', () => {
it('commits with payload', () => {
const payload = {};
testAction(actions.updateFileEditor, payload, {}, [
return testAction(actions.updateFileEditor, payload, {}, [
{ type: types.UPDATE_FILE_EDITOR, payload },
]);
});
......@@ -18,7 +18,7 @@ describe('~/ide/stores/modules/editor/actions', () => {
it('commits with payload', () => {
const payload = 'path/to/file.txt';
testAction(actions.removeFileEditor, payload, {}, [
return testAction(actions.removeFileEditor, payload, {}, [
{ type: types.REMOVE_FILE_EDITOR, payload },
]);
});
......@@ -28,7 +28,7 @@ describe('~/ide/stores/modules/editor/actions', () => {
it('commits with payload', () => {
const payload = createTriggerRenamePayload('test', 'test123');
testAction(actions.renameFileEditor, payload, {}, [
return testAction(actions.renameFileEditor, payload, {}, [
{ type: types.RENAME_FILE_EDITOR, payload },
]);
});
......
......@@ -142,7 +142,7 @@ describe('Vuex members actions', () => {
describe('showRemoveGroupLinkModal', () => {
it(`commits ${types.SHOW_REMOVE_GROUP_LINK_MODAL} mutation`, () => {
testAction(showRemoveGroupLinkModal, group, state, [
return testAction(showRemoveGroupLinkModal, group, state, [
{
type: types.SHOW_REMOVE_GROUP_LINK_MODAL,
payload: group,
......@@ -153,7 +153,7 @@ describe('Vuex members actions', () => {
describe('hideRemoveGroupLinkModal', () => {
it(`commits ${types.HIDE_REMOVE_GROUP_LINK_MODAL} mutation`, () => {
testAction(hideRemoveGroupLinkModal, group, state, [
return testAction(hideRemoveGroupLinkModal, group, state, [
{
type: types.HIDE_REMOVE_GROUP_LINK_MODAL,
},
......@@ -170,7 +170,7 @@ describe('Vuex members actions', () => {
describe('showRemoveMemberModal', () => {
it(`commits ${types.SHOW_REMOVE_MEMBER_MODAL} mutation`, () => {
testAction(showRemoveMemberModal, modalData, state, [
return testAction(showRemoveMemberModal, modalData, state, [
{
type: types.SHOW_REMOVE_MEMBER_MODAL,
payload: modalData,
......@@ -181,7 +181,7 @@ describe('Vuex members actions', () => {
describe('hideRemoveMemberModal', () => {
it(`commits ${types.HIDE_REMOVE_MEMBER_MODAL} mutation`, () => {
testAction(hideRemoveMemberModal, undefined, state, [
return testAction(hideRemoveMemberModal, undefined, state, [
{
type: types.HIDE_REMOVE_MEMBER_MODAL,
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment