Commit eb4687d0 authored by Sarah Groff Hennigh-Palermo's avatar Sarah Groff Hennigh-Palermo

Merge branch 'renovate-vue/vuex-3.x' into 'master'

Update dependency vuex to ^3.5.1

Closes #227151

See merge request gitlab-org/gitlab!39201
parents b3c05ea9 02c8bb06
---
title: Update dependency vuex to ^3.5.1
merge_request: 39201
author:
type: other
......@@ -241,7 +241,7 @@ describe('CodeReviewAnalyticsApp component', () => {
});
it('should call the setPage action', () => {
expect(setPage).toHaveBeenCalledWith(expect.anything(), 2, undefined);
expect(setPage).toHaveBeenCalledWith(expect.anything(), 2);
});
it('should call fetchMergeRequests action', () => {
......
......@@ -115,14 +115,10 @@ describe('FilteredSearchBar', () => {
expect(utils.processFilters).toHaveBeenCalledWith(filters);
expect(setFiltersMock).toHaveBeenCalledWith(
expect.anything(),
{
selectedLabelList: [{ value: 'my-label', operator: '=' }],
selectedMilestone: { value: 'my-milestone', operator: '=' },
},
undefined,
);
expect(setFiltersMock).toHaveBeenCalledWith(expect.anything(), {
selectedLabelList: [{ value: 'my-label', operator: '=' }],
selectedMilestone: { value: 'my-milestone', operator: '=' },
});
});
});
});
......@@ -105,7 +105,6 @@ describe('DurationChart', () => {
expect(actionSpies.updateSelectedDurationChartStages).toHaveBeenCalledWith(
expect.any(Object),
selectedStages,
undefined,
);
});
});
......
......@@ -168,16 +168,12 @@ describe('Filter bar', () => {
expect(utils.processFilters).toHaveBeenCalledWith(filters);
expect(setFiltersMock).toHaveBeenCalledWith(
expect.anything(),
{
selectedLabelList: [{ value: selectedLabelList[0].title, operator: '=' }],
selectedMilestone: { value: selectedMilestone[0].title, operator: '=' },
selectedAssigneeList: [],
selectedAuthor: null,
},
undefined,
);
expect(setFiltersMock).toHaveBeenCalledWith(expect.anything(), {
selectedLabelList: [{ value: selectedLabelList[0].title, operator: '=' }],
selectedMilestone: { value: selectedMilestone[0].title, operator: '=' },
selectedAssigneeList: [],
selectedAuthor: null,
});
});
});
......
......@@ -110,11 +110,7 @@ describe('TypeOfWorkCharts', () => {
});
it('calls the setTasksByTypeFilters method', () => {
expect(actionSpies.setTasksByTypeFilters).toHaveBeenCalledWith(
expect.any(Object),
payload,
undefined,
);
expect(actionSpies.setTasksByTypeFilters).toHaveBeenCalledWith(expect.any(Object), payload);
});
});
......
......@@ -162,11 +162,9 @@ describe('ValueStreamSelect', () => {
});
it('calls the "createValueStream" event when submitted', () => {
expect(createValueStreamMock).toHaveBeenCalledWith(
expect.any(Object),
{ name: streamName },
undefined,
);
expect(createValueStreamMock).toHaveBeenCalledWith(expect.any(Object), {
name: streamName,
});
});
it('clears the name field', () => {
......
......@@ -60,11 +60,9 @@ describe('EE Approvals App', () => {
store.state.settings.mrSettingsPath = null;
factory();
expect(store.modules.approvals.actions.fetchRules).toHaveBeenCalledWith(
expect.anything(),
{ targetBranch: targetBranchName },
undefined,
);
expect(store.modules.approvals.actions.fetchRules).toHaveBeenCalledWith(expect.anything(), {
targetBranch: targetBranchName,
});
});
it('passes the target branch name in fetchRules for MR edit path', () => {
......@@ -72,11 +70,9 @@ describe('EE Approvals App', () => {
store.state.settings.mrSettingsPath = 'some/path';
factory();
expect(store.modules.approvals.actions.fetchRules).toHaveBeenCalledWith(
expect.anything(),
{ targetBranch: targetBranchName },
undefined,
);
expect(store.modules.approvals.actions.fetchRules).toHaveBeenCalledWith(expect.anything(), {
targetBranch: targetBranchName,
});
});
it('does not pass the target branch name in fetchRules for project settings path', () => {
......@@ -84,11 +80,9 @@ describe('EE Approvals App', () => {
store.modules.approvals.state.targetBranch = null;
factory();
expect(store.modules.approvals.actions.fetchRules).toHaveBeenCalledWith(
expect.anything(),
{ targetBranch: null },
undefined,
);
expect(store.modules.approvals.actions.fetchRules).toHaveBeenCalledWith(expect.anything(), {
targetBranch: null,
});
});
});
......@@ -188,7 +182,6 @@ describe('EE Approvals App', () => {
expect(store.modules.createModal.actions.open).toHaveBeenCalledWith(
expect.anything(),
null,
undefined,
);
});
});
......@@ -226,7 +219,6 @@ describe('EE Approvals App', () => {
expect(store.modules.approvals.actions.fetchRules).toHaveBeenLastCalledWith(
expect.anything(),
{ targetBranch, resetToDefault: true },
undefined,
);
expect(showToast).toHaveBeenCalledWith('Approval rules reset to project defaults', {
action: {
......
......@@ -126,7 +126,6 @@ describe('EE Approvals LicenseCompliance', () => {
expect(store.modules.approvalsModal.actions.open).toHaveBeenCalledWith(
expect.any(Object),
mockLicenseCheckRule,
undefined,
);
});
});
......
......@@ -97,6 +97,6 @@ describe('Approvals ModalRuleRemove', () => {
const modal = wrapper.find(GlModalVuex);
modal.vm.$emit('ok', new Event('submit'));
expect(actions.deleteRule).toHaveBeenCalledWith(expect.anything(), TEST_RULE.id, undefined);
expect(actions.deleteRule).toHaveBeenCalledWith(expect.anything(), TEST_RULE.id);
});
});
......@@ -83,11 +83,7 @@ describe('Rule Input', () => {
jest.runAllTimers();
return wrapper.vm.$nextTick().then(() => {
expect(action).toHaveBeenCalledWith(
expect.anything(),
{ approvalsRequired: 10, id: 5 },
undefined,
);
expect(action).toHaveBeenCalledWith(expect.anything(), { approvalsRequired: 10, id: 5 });
});
});
});
......@@ -32,7 +32,7 @@ describe('Approvals ProjectRules', () => {
let store;
const factory = (props = {}, options = {}) => {
wrapper = mount(localVue.extend(ProjectRules), {
wrapper = mount(ProjectRules, {
propsData: props,
store: new Vuex.Store(store),
localVue,
......@@ -100,8 +100,6 @@ describe('Approvals ProjectRules', () => {
});
it('should only display 1 rule', () => {
factory();
expect(store.modules.approvals.state.rules.length).toBe(1);
});
});
......
......@@ -70,7 +70,6 @@ describe('EE Approvals RuleControls', () => {
expect(store.modules.approvals.actions.requestEditRule).toHaveBeenCalledWith(
expect.anything(),
TEST_RULE,
undefined,
);
});
});
......@@ -95,7 +94,6 @@ describe('EE Approvals RuleControls', () => {
expect(store.modules.approvals.actions.requestDeleteRule).toHaveBeenCalledWith(
expect.anything(),
TEST_RULE,
undefined,
);
});
});
......
......@@ -49,7 +49,7 @@ describe('EE Approvals RuleForm', () => {
let actions;
const createComponent = (props = {}, options = {}) => {
wrapper = shallowMount(localVue.extend(RuleForm), {
wrapper = shallowMount(RuleForm, {
propsData: props,
store: new Vuex.Store(store),
localVue,
......@@ -176,7 +176,7 @@ describe('EE Approvals RuleForm', () => {
wrapper.vm.submit();
expect(actions.postRule).toHaveBeenCalledWith(expect.anything(), expected, undefined);
expect(actions.postRule).toHaveBeenCalledWith(expect.anything(), expected);
});
});
});
......@@ -279,7 +279,7 @@ describe('EE Approvals RuleForm', () => {
it('on submit, posts rule', () => {
wrapper.vm.submit();
expect(actions.postRule).toHaveBeenCalledWith(expect.anything(), expected, undefined);
expect(actions.postRule).toHaveBeenCalledWith(expect.anything(), expected);
});
it('when submitted with a duplicate name, shows the "taken name" validation', async () => {
......@@ -358,7 +358,7 @@ describe('EE Approvals RuleForm', () => {
it('on submit, puts rule', () => {
wrapper.vm.submit();
expect(actions.putRule).toHaveBeenCalledWith(expect.anything(), expected, undefined);
expect(actions.putRule).toHaveBeenCalledWith(expect.anything(), expected);
});
it('when submitted with a duplicate name, shows the "taken name" validation', async () => {
......@@ -402,11 +402,9 @@ describe('EE Approvals RuleForm', () => {
});
it('puts fallback rule', () => {
expect(actions.putFallbackRule).toHaveBeenCalledWith(
expect.anything(),
{ approvalsRequired: TEST_APPROVALS_REQUIRED },
undefined,
);
expect(actions.putFallbackRule).toHaveBeenCalledWith(expect.anything(), {
approvalsRequired: TEST_APPROVALS_REQUIRED,
});
});
it('does not show any validation errors', () => {
......@@ -495,7 +493,6 @@ describe('EE Approvals RuleForm', () => {
expect.objectContaining({
removeHiddenGroups: false,
}),
undefined,
);
});
......@@ -512,7 +509,6 @@ describe('EE Approvals RuleForm', () => {
expect.objectContaining({
removeHiddenGroups: true,
}),
undefined,
);
});
});
......@@ -662,7 +658,6 @@ describe('EE Approvals RuleForm', () => {
approvalsRequired: TEST_APPROVALS_REQUIRED,
users: TEST_APPROVERS.map(x => x.id),
}),
undefined,
);
});
});
......@@ -675,11 +670,9 @@ describe('EE Approvals RuleForm', () => {
});
it('puts fallback rule', () => {
expect(actions.putFallbackRule).toHaveBeenCalledWith(
expect.anything(),
{ approvalsRequired: TEST_APPROVALS_REQUIRED },
undefined,
);
expect(actions.putFallbackRule).toHaveBeenCalledWith(expect.anything(), {
approvalsRequired: TEST_APPROVALS_REQUIRED,
});
});
});
});
......@@ -708,19 +701,13 @@ describe('EE Approvals RuleForm', () => {
});
it('deletes rule', () => {
expect(actions.deleteRule).toHaveBeenCalledWith(
expect.anything(),
TEST_RULE.id,
undefined,
);
expect(actions.deleteRule).toHaveBeenCalledWith(expect.anything(), TEST_RULE.id);
});
it('puts fallback rule', () => {
expect(actions.putFallbackRule).toHaveBeenCalledWith(
expect.anything(),
{ approvalsRequired: TEST_APPROVALS_REQUIRED },
undefined,
);
expect(actions.putFallbackRule).toHaveBeenCalledWith(expect.anything(), {
approvalsRequired: TEST_APPROVALS_REQUIRED,
});
});
});
......@@ -742,7 +729,6 @@ describe('EE Approvals RuleForm', () => {
approvalsRequired: TEST_APPROVALS_REQUIRED,
users: TEST_APPROVERS.map(x => x.id),
}),
undefined,
);
});
});
......
......@@ -80,7 +80,6 @@ describe('GeoNodeFormNamespaces', () => {
expect(actionSpies.fetchSyncNamespaces).toHaveBeenCalledWith(
expect.any(Object),
namespaceSearch,
undefined,
);
});
});
......
......@@ -78,7 +78,7 @@ describe('GeoReplicableFilterBar', () => {
.at(index)
.vm.$emit('click');
expect(actionSpies.setFilter).toHaveBeenCalledWith(expect.any(Object), index, undefined);
expect(actionSpies.setFilter).toHaveBeenCalledWith(expect.any(Object), index);
});
});
......@@ -99,11 +99,7 @@ describe('GeoReplicableFilterBar', () => {
});
it('calls fetchSyncNamespaces when input event is fired from GlSearchBoxByType', () => {
expect(actionSpies.setSearch).toHaveBeenCalledWith(
expect.any(Object),
testSearch,
undefined,
);
expect(actionSpies.setSearch).toHaveBeenCalledWith(expect.any(Object), testSearch);
expect(actionSpies.fetchReplicableItems).toHaveBeenCalled();
});
});
......@@ -130,7 +126,7 @@ describe('GeoReplicableFilterBar', () => {
});
it('should call setFilter with the filterIndex', () => {
expect(actionSpies.setFilter).toHaveBeenCalledWith(expect.any(Object), testValue, undefined);
expect(actionSpies.setFilter).toHaveBeenCalledWith(expect.any(Object), testValue);
});
it('should call fetchReplicableItems', () => {
......
......@@ -83,15 +83,11 @@ describe('GeoReplicableItem', () => {
it('calls initiateReplicableSync when clicked', () => {
findGlButton().trigger('click');
expect(actionSpies.initiateReplicableSync).toHaveBeenCalledWith(
expect.any(Object),
{
projectId: mockReplicable.projectId,
name: mockReplicable.name,
action: ACTION_TYPES.RESYNC,
},
undefined,
);
expect(actionSpies.initiateReplicableSync).toHaveBeenCalledWith(expect.any(Object), {
projectId: mockReplicable.projectId,
name: mockReplicable.name,
action: ACTION_TYPES.RESYNC,
});
});
});
});
......
......@@ -71,7 +71,7 @@ describe('SAML providers members app', () => {
const changeFn = wrapper.find(TablePagination).props('change');
changeFn(2);
return wrapper.vm.$nextTick(() => {
expect(fetchPageMock).toHaveBeenCalledWith(expect.anything(), 2, undefined);
expect(fetchPageMock).toHaveBeenCalledWith(expect.anything(), 2);
});
});
});
......
......@@ -98,7 +98,6 @@ describe('DeleteConfirmationModal', () => {
expect(actions.deleteLicense).toHaveBeenCalledWith(
expect.any(Object),
store.state.licenseManagement.currentLicenseInModal,
undefined,
);
});
});
......
......@@ -300,7 +300,6 @@ describe('SetApprovalModal', () => {
expect(actions.allowLicense).toHaveBeenCalledWith(
expect.any(Object),
store.state.licenseManagement.currentLicenseInModal,
undefined,
);
});
});
......@@ -313,7 +312,6 @@ describe('SetApprovalModal', () => {
expect(actions.denyLicense).toHaveBeenCalledWith(
expect.any(Object),
store.state.licenseManagement.currentLicenseInModal,
undefined,
);
});
});
......
......@@ -121,11 +121,7 @@ describe('License Management', () => {
isAdmin,
});
expect(fetchManagedLicensesMock).toHaveBeenCalledWith(
expect.any(Object),
undefined,
undefined,
);
expect(fetchManagedLicensesMock).toHaveBeenCalledWith(expect.any(Object), undefined);
});
});
});
......
......@@ -347,27 +347,18 @@ describe('License Report MR Widget', () => {
};
mountComponent({ actions });
expect(actions.setAPISettings).toHaveBeenCalledWith(
expect.any(Object),
{
apiUrlManageLicenses: apiUrl,
licensesApiPath: defaultProps.licensesApiPath,
approvalsApiPath: defaultProps.approvalsApiPath,
canManageLicenses: true,
},
undefined,
);
expect(actions.setAPISettings).toHaveBeenCalledWith(expect.any(Object), {
apiUrlManageLicenses: apiUrl,
licensesApiPath: defaultProps.licensesApiPath,
approvalsApiPath: defaultProps.approvalsApiPath,
canManageLicenses: true,
});
expect(actions.fetchParsedLicenseReport).toHaveBeenCalledWith(
expect.any(Object),
undefined,
undefined,
);
expect(actions.fetchParsedLicenseReport).toHaveBeenCalledWith(expect.any(Object), undefined);
expect(actions.fetchLicenseCheckApprovalRule).toHaveBeenCalledWith(
expect.any(Object),
undefined,
undefined,
);
});
......
......@@ -78,7 +78,7 @@ describe('AddContextCommitsModal', () => {
findSearch().vm.$emit('input', searchText);
expect(searchCommits).not.toBeCalled();
jest.advanceTimersByTime(500);
expect(searchCommits).toHaveBeenCalledWith(expect.anything(), searchText, undefined);
expect(searchCommits).toHaveBeenCalledWith(expect.anything(), searchText);
});
it('disabled ok button when no row is selected', () => {
......@@ -119,18 +119,17 @@ describe('AddContextCommitsModal', () => {
wrapper.vm.$store.state.selectedCommits = [{ ...commit, isSelected: true }];
findModal().vm.$emit('ok');
return wrapper.vm.$nextTick().then(() => {
expect(createContextCommits).toHaveBeenCalledWith(
expect.anything(),
{ commits: [{ ...commit, isSelected: true }], forceReload: true },
undefined,
);
expect(createContextCommits).toHaveBeenCalledWith(expect.anything(), {
commits: [{ ...commit, isSelected: true }],
forceReload: true,
});
});
});
it('"removeContextCommits" when only added commits are to be removed ', () => {
wrapper.vm.$store.state.toRemoveCommits = [commit.short_id];
findModal().vm.$emit('ok');
return wrapper.vm.$nextTick().then(() => {
expect(removeContextCommits).toHaveBeenCalledWith(expect.anything(), true, undefined);
expect(removeContextCommits).toHaveBeenCalledWith(expect.anything(), true);
});
});
it('"createContextCommits" and "removeContextCommits" when new commits are to be added and old commits are to be removed', () => {
......@@ -138,12 +137,10 @@ describe('AddContextCommitsModal', () => {
wrapper.vm.$store.state.toRemoveCommits = [commit.short_id];
findModal().vm.$emit('ok');
return wrapper.vm.$nextTick().then(() => {
expect(createContextCommits).toHaveBeenCalledWith(
expect.anything(),
{ commits: [{ ...commit, isSelected: true }] },
undefined,
);
expect(removeContextCommits).toHaveBeenCalledWith(expect.anything(), undefined, undefined);
expect(createContextCommits).toHaveBeenCalledWith(expect.anything(), {
commits: [{ ...commit, isSelected: true }],
});
expect(removeContextCommits).toHaveBeenCalledWith(expect.anything(), undefined);
});
});
});
......@@ -156,7 +153,7 @@ describe('AddContextCommitsModal', () => {
});
it('"resetModalState" to reset all the modal state', () => {
findModal().vm.$emit('cancel');
expect(resetModalState).toHaveBeenCalledWith(expect.anything(), undefined, undefined);
expect(resetModalState).toHaveBeenCalledWith(expect.anything(), undefined);
});
});
......@@ -168,7 +165,7 @@ describe('AddContextCommitsModal', () => {
});
it('"resetModalState" to reset all the modal state', () => {
findModal().vm.$emit('close');
expect(resetModalState).toHaveBeenCalledWith(expect.anything(), undefined, undefined);
expect(resetModalState).toHaveBeenCalledWith(expect.anything(), undefined);
});
});
});
......@@ -401,43 +401,33 @@ describe('EksClusterConfigurationForm', () => {
});
it('dispatches setRegion action', () => {
expect(actions.setRegion).toHaveBeenCalledWith(expect.anything(), { region }, undefined);
expect(actions.setRegion).toHaveBeenCalledWith(expect.anything(), { region });
});
it('fetches available vpcs', () => {
expect(vpcsActions.fetchItems).toHaveBeenCalledWith(expect.anything(), { region }, undefined);
expect(vpcsActions.fetchItems).toHaveBeenCalledWith(expect.anything(), { region });
});
it('fetches available key pairs', () => {
expect(keyPairsActions.fetchItems).toHaveBeenCalledWith(
expect.anything(),
{ region },
undefined,
);
expect(keyPairsActions.fetchItems).toHaveBeenCalledWith(expect.anything(), { region });
});
it('cleans selected vpc', () => {
expect(actions.setVpc).toHaveBeenCalledWith(expect.anything(), { vpc: null }, undefined);
expect(actions.setVpc).toHaveBeenCalledWith(expect.anything(), { vpc: null });
});
it('cleans selected key pair', () => {
expect(actions.setKeyPair).toHaveBeenCalledWith(
expect.anything(),
{ keyPair: null },
undefined,
);
expect(actions.setKeyPair).toHaveBeenCalledWith(expect.anything(), { keyPair: null });
});
it('cleans selected subnet', () => {
expect(actions.setSubnet).toHaveBeenCalledWith(expect.anything(), { subnet: [] }, undefined);
expect(actions.setSubnet).toHaveBeenCalledWith(expect.anything(), { subnet: [] });
});
it('cleans selected security group', () => {
expect(actions.setSecurityGroup).toHaveBeenCalledWith(
expect.anything(),
{ securityGroup: null },
undefined,
);
expect(actions.setSecurityGroup).toHaveBeenCalledWith(expect.anything(), {
securityGroup: null,
});
});
});
......@@ -446,11 +436,7 @@ describe('EksClusterConfigurationForm', () => {
findClusterNameInput().vm.$emit('input', clusterName);
expect(actions.setClusterName).toHaveBeenCalledWith(
expect.anything(),
{ clusterName },
undefined,
);
expect(actions.setClusterName).toHaveBeenCalledWith(expect.anything(), { clusterName });
});
it('dispatches setEnvironmentScope when environment scope input changes', () => {
......@@ -458,11 +444,9 @@ describe('EksClusterConfigurationForm', () => {
findEnvironmentScopeInput().vm.$emit('input', environmentScope);
expect(actions.setEnvironmentScope).toHaveBeenCalledWith(
expect.anything(),
{ environmentScope },
undefined,
);
expect(actions.setEnvironmentScope).toHaveBeenCalledWith(expect.anything(), {
environmentScope,
});
});
it('dispatches setKubernetesVersion when kubernetes version dropdown changes', () => {
......@@ -470,11 +454,9 @@ describe('EksClusterConfigurationForm', () => {
findKubernetesVersionDropdown().vm.$emit('input', kubernetesVersion);
expect(actions.setKubernetesVersion).toHaveBeenCalledWith(
expect.anything(),
{ kubernetesVersion },
undefined,
);
expect(actions.setKubernetesVersion).toHaveBeenCalledWith(expect.anything(), {
kubernetesVersion,
});
});
it('dispatches setGitlabManagedCluster when gitlab managed cluster input changes', () => {
......@@ -482,11 +464,9 @@ describe('EksClusterConfigurationForm', () => {
findGitlabManagedClusterCheckbox().vm.$emit('input', gitlabManagedCluster);
expect(actions.setGitlabManagedCluster).toHaveBeenCalledWith(
expect.anything(),
{ gitlabManagedCluster },
undefined,
);
expect(actions.setGitlabManagedCluster).toHaveBeenCalledWith(expect.anything(), {
gitlabManagedCluster,
});
});
describe('when vpc is selected', () => {
......@@ -499,35 +479,28 @@ describe('EksClusterConfigurationForm', () => {
});
it('dispatches setVpc action', () => {
expect(actions.setVpc).toHaveBeenCalledWith(expect.anything(), { vpc }, undefined);
expect(actions.setVpc).toHaveBeenCalledWith(expect.anything(), { vpc });
});
it('cleans selected subnet', () => {
expect(actions.setSubnet).toHaveBeenCalledWith(expect.anything(), { subnet: [] }, undefined);
expect(actions.setSubnet).toHaveBeenCalledWith(expect.anything(), { subnet: [] });
});
it('cleans selected security group', () => {
expect(actions.setSecurityGroup).toHaveBeenCalledWith(
expect.anything(),
{ securityGroup: null },
undefined,
);
expect(actions.setSecurityGroup).toHaveBeenCalledWith(expect.anything(), {
securityGroup: null,
});
});
it('dispatches fetchSubnets action', () => {
expect(subnetsActions.fetchItems).toHaveBeenCalledWith(
expect.anything(),
{ vpc, region },
undefined,
);
expect(subnetsActions.fetchItems).toHaveBeenCalledWith(expect.anything(), { vpc, region });
});
it('dispatches fetchSecurityGroups action', () => {
expect(securityGroupsActions.fetchItems).toHaveBeenCalledWith(
expect.anything(),
{ vpc, region },
undefined,
);
expect(securityGroupsActions.fetchItems).toHaveBeenCalledWith(expect.anything(), {
vpc,
region,
});
});
});
......@@ -539,7 +512,7 @@ describe('EksClusterConfigurationForm', () => {
});
it('dispatches setSubnet action', () => {
expect(actions.setSubnet).toHaveBeenCalledWith(expect.anything(), { subnet }, undefined);
expect(actions.setSubnet).toHaveBeenCalledWith(expect.anything(), { subnet });
});
});
......@@ -551,7 +524,7 @@ describe('EksClusterConfigurationForm', () => {
});
it('dispatches setRole action', () => {
expect(actions.setRole).toHaveBeenCalledWith(expect.anything(), { role }, undefined);
expect(actions.setRole).toHaveBeenCalledWith(expect.anything(), { role });
});
});
......@@ -563,7 +536,7 @@ describe('EksClusterConfigurationForm', () => {
});
it('dispatches setKeyPair action', () => {
expect(actions.setKeyPair).toHaveBeenCalledWith(expect.anything(), { keyPair }, undefined);
expect(actions.setKeyPair).toHaveBeenCalledWith(expect.anything(), { keyPair });
});
});
......@@ -575,11 +548,7 @@ describe('EksClusterConfigurationForm', () => {
});
it('dispatches setSecurityGroup action', () => {
expect(actions.setSecurityGroup).toHaveBeenCalledWith(
expect.anything(),
{ securityGroup },
undefined,
);
expect(actions.setSecurityGroup).toHaveBeenCalledWith(expect.anything(), { securityGroup });
});
});
......@@ -591,11 +560,7 @@ describe('EksClusterConfigurationForm', () => {
});
it('dispatches setInstanceType action', () => {
expect(actions.setInstanceType).toHaveBeenCalledWith(
expect.anything(),
{ instanceType },
undefined,
);
expect(actions.setInstanceType).toHaveBeenCalledWith(expect.anything(), { instanceType });
});
});
......@@ -604,7 +569,7 @@ describe('EksClusterConfigurationForm', () => {
findNodeCountInput().vm.$emit('input', nodeCount);
expect(actions.setNodeCount).toHaveBeenCalledWith(expect.anything(), { nodeCount }, undefined);
expect(actions.setNodeCount).toHaveBeenCalledWith(expect.anything(), { nodeCount });
});
describe('when all cluster configuration fields are set', () => {
......
......@@ -124,11 +124,7 @@ describe('GkeMachineTypeDropdown', () => {
wrapper.find('.dropdown-content button').trigger('click');
return wrapper.vm.$nextTick().then(() => {
expect(setMachineType).toHaveBeenCalledWith(
expect.anything(),
selectedMachineTypeMock,
undefined,
);
expect(setMachineType).toHaveBeenCalledWith(expect.anything(), selectedMachineTypeMock);
});
});
});
......
......@@ -121,23 +121,19 @@ describe('GkeNetworkDropdown', () => {
});
it('cleans selected subnetwork', () => {
expect(setSubnetwork).toHaveBeenCalledWith(expect.anything(), '', undefined);
expect(setSubnetwork).toHaveBeenCalledWith(expect.anything(), '');
});
it('dispatches the setNetwork action', () => {
expect(setNetwork).toHaveBeenCalledWith(expect.anything(), selectedNetwork, undefined);
expect(setNetwork).toHaveBeenCalledWith(expect.anything(), selectedNetwork);
});
it('fetches subnetworks for the selected project, region, and network', () => {
expect(fetchSubnetworks).toHaveBeenCalledWith(
expect.anything(),
{
project: projectId,
region,
network: selectedNetwork.selfLink,
},
undefined,
);
expect(fetchSubnetworks).toHaveBeenCalledWith(expect.anything(), {
project: projectId,
region,
network: selectedNetwork.selfLink,
});
});
});
});
......@@ -130,7 +130,6 @@ describe('GkeProjectIdDropdown', () => {
expect(setProject).toHaveBeenCalledWith(
expect.anything(),
gapiProjectsResponseMock.projects[0],
undefined,
);
});
});
......
......@@ -107,7 +107,7 @@ describe('GkeSubnetworkDropdown', () => {
wrapper.find(ClusterFormDropdown).vm.$emit('input', selectedSubnetwork);
expect(setSubnetwork).toHaveBeenCalledWith(expect.anything(), selectedSubnetwork, undefined);
expect(setSubnetwork).toHaveBeenCalledWith(expect.anything(), selectedSubnetwork);
});
});
});
......@@ -177,23 +177,19 @@ describe('DiffContent', () => {
});
wrapper.find(NoteForm).vm.$emit('handleFormUpdate', noteStub);
expect(saveDiffDiscussionMock).toHaveBeenCalledWith(
expect.any(Object),
{
note: noteStub,
formData: {
noteableData: expect.any(Object),
diffFile: currentDiffFile,
positionType: IMAGE_DIFF_POSITION_TYPE,
x: undefined,
y: undefined,
width: undefined,
height: undefined,
noteableType: undefined,
},
expect(saveDiffDiscussionMock).toHaveBeenCalledWith(expect.any(Object), {
note: noteStub,
formData: {
noteableData: expect.any(Object),
diffFile: currentDiffFile,
positionType: IMAGE_DIFF_POSITION_TYPE,
x: undefined,
y: undefined,
width: undefined,
height: undefined,
noteableType: undefined,
},
undefined,
);
});
});
});
});
import { shallowMount, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex';
import { GlIcon } from '@gitlab/ui';
import { cloneDeep } from 'lodash';
import DiffFileHeader from '~/diffs/components/diff_file_header.vue';
import EditButton from '~/diffs/components/edit_button.vue';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
......@@ -26,12 +27,16 @@ const diffFile = Object.freeze(
}),
);
const localVue = createLocalVue();
localVue.use(Vuex);
describe('DiffFileHeader component', () => {
let wrapper;
let mockStoreConfig;
const diffHasExpandedDiscussionsResultMock = jest.fn();
const diffHasDiscussionsResultMock = jest.fn();
const mockStoreConfig = {
const defaultMockStoreConfig = {
state: {},
modules: {
diffs: {
......@@ -56,6 +61,8 @@ describe('DiffFileHeader component', () => {
diffHasExpandedDiscussionsResultMock,
...Object.values(mockStoreConfig.modules.diffs.actions),
].forEach(mock => mock.mockReset());
wrapper.destroy();
});
const findHeader = () => wrapper.find({ ref: 'header' });
......@@ -80,8 +87,7 @@ describe('DiffFileHeader component', () => {
};
const createComponent = props => {
const localVue = createLocalVue();
localVue.use(Vuex);
mockStoreConfig = cloneDeep(defaultMockStoreConfig);
const store = new Vuex.Store(mockStoreConfig);
wrapper = shallowMount(DiffFileHeader, {
......@@ -286,7 +292,7 @@ describe('DiffFileHeader component', () => {
findToggleDiscussionsButton().vm.$emit('click');
expect(
mockStoreConfig.modules.diffs.actions.toggleFileDiscussionWrappers,
).toHaveBeenCalledWith(expect.any(Object), diffFile, undefined);
).toHaveBeenCalledWith(expect.any(Object), diffFile);
});
});
......
......@@ -50,7 +50,7 @@ describe('Diff settings dropdown component', () => {
vm.find('.js-list-view').trigger('click');
expect(actions.setRenderTreeList).toHaveBeenCalledWith(expect.anything(), false, undefined);
expect(actions.setRenderTreeList).toHaveBeenCalledWith(expect.anything(), false);
});
it('tree view button dispatches setRenderTreeList with true', () => {
......@@ -58,7 +58,7 @@ describe('Diff settings dropdown component', () => {
vm.find('.js-tree-view').trigger('click');
expect(actions.setRenderTreeList).toHaveBeenCalledWith(expect.anything(), true, undefined);
expect(actions.setRenderTreeList).toHaveBeenCalledWith(expect.anything(), true);
});
it('sets list button as selected when renderTreeList is false', () => {
......@@ -153,14 +153,10 @@ describe('Diff settings dropdown component', () => {
checkbox.element.checked = true;
checkbox.trigger('change');
expect(actions.setShowWhitespace).toHaveBeenCalledWith(
expect.anything(),
{
showWhitespace: true,
pushState: true,
},
undefined,
);
expect(actions.setShowWhitespace).toHaveBeenCalledWith(expect.anything(), {
showWhitespace: true,
pushState: true,
});
});
});
});
......@@ -259,23 +259,15 @@ describe('ErrorTrackingList', () => {
errorId: errorsList[0].id,
status: 'ignored',
});
expect(actions.updateStatus).toHaveBeenCalledWith(
expect.anything(),
{
endpoint: `/project/test/-/error_tracking/${errorsList[0].id}.json`,
status: 'ignored',
},
undefined,
);
expect(actions.updateStatus).toHaveBeenCalledWith(expect.anything(), {
endpoint: `/project/test/-/error_tracking/${errorsList[0].id}.json`,
status: 'ignored',
});
});
it('calls an action to remove the item from the list', () => {
findErrorActions().vm.$emit('update-issue-status', { errorId: '1', status: undefined });
expect(actions.removeIgnoredResolvedErrors).toHaveBeenCalledWith(
expect.anything(),
'1',
undefined,
);
expect(actions.removeIgnoredResolvedErrors).toHaveBeenCalledWith(expect.anything(), '1');
});
});
......@@ -298,23 +290,15 @@ describe('ErrorTrackingList', () => {
errorId: errorsList[0].id,
status: 'resolved',
});
expect(actions.updateStatus).toHaveBeenCalledWith(
expect.anything(),
{
endpoint: `/project/test/-/error_tracking/${errorsList[0].id}.json`,
status: 'resolved',
},
undefined,
);
expect(actions.updateStatus).toHaveBeenCalledWith(expect.anything(), {
endpoint: `/project/test/-/error_tracking/${errorsList[0].id}.json`,
status: 'resolved',
});
});
it('calls an action to remove the item from the list', () => {
findErrorActions().vm.$emit('update-issue-status', { errorId: '1', status: undefined });
expect(actions.removeIgnoredResolvedErrors).toHaveBeenCalledWith(
expect.anything(),
'1',
undefined,
);
expect(actions.removeIgnoredResolvedErrors).toHaveBeenCalledWith(expect.anything(), '1');
});
});
......@@ -443,7 +427,6 @@ describe('ErrorTrackingList', () => {
expect(actions.fetchPaginatedResults).toHaveBeenLastCalledWith(
expect.anything(),
'previousCursor',
undefined,
);
});
});
......@@ -462,7 +445,6 @@ describe('ErrorTrackingList', () => {
expect(actions.fetchPaginatedResults).toHaveBeenLastCalledWith(
expect.anything(),
'nextCursor',
undefined,
);
});
});
......
......@@ -51,7 +51,7 @@ describe('IDE error message component', () => {
createComponent();
findDismissButton().trigger('click');
expect(setErrorMessageMock).toHaveBeenCalledWith(expect.any(Object), null, undefined);
expect(setErrorMessageMock).toHaveBeenCalledWith(expect.any(Object), null);
});
describe('with action', () => {
......
......@@ -99,11 +99,7 @@ describe('IDE stages list', () => {
it('calls toggleStageCollapsed when clicking stage header', () => {
findCardHeader().trigger('click');
expect(storeActions.toggleStageCollapsed).toHaveBeenCalledWith(
expect.any(Object),
0,
undefined,
);
expect(storeActions.toggleStageCollapsed).toHaveBeenCalledWith(expect.any(Object), 0);
});
it('calls fetchJobs when stage is mounted', () => {
......
......@@ -56,14 +56,10 @@ describe('IDE merge requests list', () => {
it('calls fetch on mounted', () => {
createComponent();
expect(fetchMergeRequestsMock).toHaveBeenCalledWith(
expect.any(Object),
{
search: '',
type: '',
},
undefined,
);
expect(fetchMergeRequestsMock).toHaveBeenCalledWith(expect.any(Object), {
search: '',
type: '',
});
});
it('renders loading icon when merge request is loading', () => {
......@@ -95,14 +91,10 @@ describe('IDE merge requests list', () => {
const searchType = wrapper.vm.$options.searchTypes[0];
expect(findTokenedInput().props('tokens')).toEqual([searchType]);
expect(fetchMergeRequestsMock).toHaveBeenCalledWith(
expect.any(Object),
{
type: searchType.type,
search: '',
},
undefined,
);
expect(fetchMergeRequestsMock).toHaveBeenCalledWith(expect.any(Object), {
type: searchType.type,
search: '',
});
});
});
......@@ -136,14 +128,10 @@ describe('IDE merge requests list', () => {
input.vm.$emit('input', 'something');
return wrapper.vm.$nextTick().then(() => {
expect(fetchMergeRequestsMock).toHaveBeenCalledWith(
expect.any(Object),
{
search: 'something',
type: '',
},
undefined,
);
expect(fetchMergeRequestsMock).toHaveBeenCalledWith(expect.any(Object), {
search: 'something',
type: '',
});
});
});
});
......
......@@ -279,24 +279,16 @@ describe('IDE clientside preview', () => {
});
it('calls getFileData', () => {
expect(storeActions.getFileData).toHaveBeenCalledWith(
expect.any(Object),
{
path: 'package.json',
makeFileActive: false,
},
undefined, // vuex callback
);
expect(storeActions.getFileData).toHaveBeenCalledWith(expect.any(Object), {
path: 'package.json',
makeFileActive: false,
});
});
it('calls getRawFileData', () => {
expect(storeActions.getRawFileData).toHaveBeenCalledWith(
expect.any(Object),
{
path: 'package.json',
},
undefined, // vuex callback
);
expect(storeActions.getRawFileData).toHaveBeenCalledWith(expect.any(Object), {
path: 'package.json',
});
});
});
......
......@@ -194,13 +194,9 @@ describe('Discussion navigation mixin', () => {
});
it('expands discussion', () => {
expect(expandDiscussion).toHaveBeenCalledWith(
expect.anything(),
{
discussionId: expected,
},
undefined,
);
expect(expandDiscussion).toHaveBeenCalledWith(expect.anything(), {
discussionId: expected,
});
});
it('scrolls to discussion', () => {
......
......@@ -133,11 +133,7 @@ describe('Author Select', () => {
const authorName = 'lorem';
findSearchBox().vm.$emit('input', authorName);
expect(store.actions.fetchAuthors).toHaveBeenCalledWith(
expect.anything(),
authorName,
undefined,
);
expect(store.actions.fetchAuthors).toHaveBeenCalledWith(expect.anything(), authorName);
});
});
......
......@@ -115,14 +115,10 @@ describe('Release edit component', () => {
const expectStoreMethodToBeCalled = () => {
expect(actions.updateAssetLinkUrl).toHaveBeenCalledTimes(1);
expect(actions.updateAssetLinkUrl).toHaveBeenCalledWith(
expect.anything(),
{
linkIdToUpdate,
newUrl,
},
undefined,
);
expect(actions.updateAssetLinkUrl).toHaveBeenCalledWith(expect.anything(), {
linkIdToUpdate,
newUrl,
});
};
it('calls the "updateAssetLinkUrl" store method when text is entered into the "URL" input field', () => {
......@@ -177,14 +173,10 @@ describe('Release edit component', () => {
const expectStoreMethodToBeCalled = () => {
expect(actions.updateAssetLinkName).toHaveBeenCalledTimes(1);
expect(actions.updateAssetLinkName).toHaveBeenCalledWith(
expect.anything(),
{
linkIdToUpdate,
newName,
},
undefined,
);
expect(actions.updateAssetLinkName).toHaveBeenCalledWith(expect.anything(), {
linkIdToUpdate,
newName,
});
};
it('calls the "updateAssetLinkName" store method when text is entered into the "Link title" input field', () => {
......@@ -225,14 +217,10 @@ describe('Release edit component', () => {
wrapper.find({ ref: 'typeSelect' }).vm.$emit('change', newType);
expect(actions.updateAssetLinkType).toHaveBeenCalledTimes(1);
expect(actions.updateAssetLinkType).toHaveBeenCalledWith(
expect.anything(),
{
linkIdToUpdate,
newType,
},
undefined,
);
expect(actions.updateAssetLinkType).toHaveBeenCalledWith(expect.anything(), {
linkIdToUpdate,
newType,
});
});
it('selects the default asset type if no type was provided by the backend', () => {
......
......@@ -12340,10 +12340,10 @@ vuedraggable@^2.23.0:
dependencies:
sortablejs "^1.9.0"
vuex@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/vuex/-/vuex-3.1.0.tgz#634b81515cf0cfe976bd1ffe9601755e51f843b9"
integrity sha512-mdHeHT/7u4BncpUZMlxNaIdcN/HIt1GsGG5LKByArvYG/v6DvHcOxvDCts+7SRdCoIRGllK8IMZvQtQXLppDYg==
vuex@^3.5.1:
version "3.5.1"
resolved "https://registry.yarnpkg.com/vuex/-/vuex-3.5.1.tgz#f1b8dcea649bc25254cf4f4358081dbf5da18b3d"
integrity sha512-w7oJzmHQs0FM9LXodfskhw9wgKBiaB+totOdb8sNzbTB2KDCEEwEs29NzBZFh/lmEK1t5tDmM1vtsO7ubG1DFw==
w3c-hr-time@^1.0.1, w3c-hr-time@^1.0.2:
version "1.0.2"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment