Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 14:18:50 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 14:18:50 +0300
commit8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch)
treea77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/frontend/releases/components/asset_links_form_spec.js
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/frontend/releases/components/asset_links_form_spec.js')
-rw-r--r--spec/frontend/releases/components/asset_links_form_spec.js34
1 files changed, 33 insertions, 1 deletions
diff --git a/spec/frontend/releases/components/asset_links_form_spec.js b/spec/frontend/releases/components/asset_links_form_spec.js
index 44542868cfe..e1f8592270e 100644
--- a/spec/frontend/releases/components/asset_links_form_spec.js
+++ b/spec/frontend/releases/components/asset_links_form_spec.js
@@ -3,6 +3,7 @@ import { mount, createLocalVue } from '@vue/test-utils';
import AssetLinksForm from '~/releases/components/asset_links_form.vue';
import { release as originalRelease } from '../mock_data';
import * as commonUtils from '~/lib/utils/common_utils';
+import { ASSET_LINK_TYPE, DEFAULT_ASSET_LINK_TYPE } from '~/releases/constants';
const localVue = createLocalVue();
localVue.use(Vuex);
@@ -24,6 +25,7 @@ describe('Release edit component', () => {
addEmptyAssetLink: jest.fn(),
updateAssetLinkUrl: jest.fn(),
updateAssetLinkName: jest.fn(),
+ updateAssetLinkType: jest.fn(),
removeAssetLink: jest.fn().mockImplementation((_context, linkId) => {
state.release.assets.links = state.release.assets.links.filter(l => l.id !== linkId);
}),
@@ -51,6 +53,11 @@ describe('Release edit component', () => {
wrapper = mount(AssetLinksForm, {
localVue,
store,
+ provide: {
+ glFeatures: {
+ releaseAssetLinkType: true,
+ },
+ },
});
};
@@ -103,7 +110,7 @@ describe('Release edit component', () => {
);
});
- it('calls the "updateAssetLinName" store method when text is entered into the "Link title" input field', () => {
+ it('calls the "updateAssetLinkName" store method when text is entered into the "Link title" input field', () => {
const linkIdToUpdate = release.assets.links[0].id;
const newName = 'updated name';
@@ -121,6 +128,31 @@ describe('Release edit component', () => {
undefined,
);
});
+
+ it('calls the "updateAssetLinkType" store method when an option is selected from the "Type" dropdown', () => {
+ const linkIdToUpdate = release.assets.links[0].id;
+ const newType = ASSET_LINK_TYPE.RUNBOOK;
+
+ expect(actions.updateAssetLinkType).not.toHaveBeenCalled();
+
+ wrapper.find({ ref: 'typeSelect' }).vm.$emit('change', newType);
+
+ expect(actions.updateAssetLinkType).toHaveBeenCalledTimes(1);
+ expect(actions.updateAssetLinkType).toHaveBeenCalledWith(
+ expect.anything(),
+ {
+ linkIdToUpdate,
+ newType,
+ },
+ undefined,
+ );
+ });
+
+ it('selects the default asset type if no type was provided by the backend', () => {
+ const selected = wrapper.find({ ref: 'typeSelect' }).element.value;
+
+ expect(selected).toBe(DEFAULT_ASSET_LINK_TYPE);
+ });
});
describe('validation', () => {