summaryrefslogtreecommitdiff
path: root/spec/frontend/releases
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/releases')
-rw-r--r--spec/frontend/releases/__snapshots__/util_spec.js.snap48
-rw-r--r--spec/frontend/releases/components/app_edit_new_spec.js6
-rw-r--r--spec/frontend/releases/components/app_index_spec.js34
-rw-r--r--spec/frontend/releases/components/app_show_spec.js2
-rw-r--r--spec/frontend/releases/components/asset_links_form_spec.js6
-rw-r--r--spec/frontend/releases/components/issuable_stats_spec.js2
-rw-r--r--spec/frontend/releases/components/release_block_assets_spec.js14
-rw-r--r--spec/frontend/releases/components/release_block_milestone_info_spec.js32
-rw-r--r--spec/frontend/releases/components/releases_pagination_graphql_spec.js4
-rw-r--r--spec/frontend/releases/components/releases_pagination_rest_spec.js2
-rw-r--r--spec/frontend/releases/components/releases_pagination_spec.js2
-rw-r--r--spec/frontend/releases/components/tag_field_new_spec.js2
-rw-r--r--spec/frontend/releases/stores/modules/detail/actions_spec.js4
-rw-r--r--spec/frontend/releases/stores/modules/list/helpers.js2
14 files changed, 73 insertions, 87 deletions
diff --git a/spec/frontend/releases/__snapshots__/util_spec.js.snap b/spec/frontend/releases/__snapshots__/util_spec.js.snap
index f49d3d7b716..c9f84be97c4 100644
--- a/spec/frontend/releases/__snapshots__/util_spec.js.snap
+++ b/spec/frontend/releases/__snapshots__/util_spec.js.snap
@@ -89,18 +89,6 @@ Object {
],
"milestones": Array [
Object {
- "description": "The 12.4 milestone",
- "id": "gid://gitlab/Milestone/124",
- "issueStats": Object {
- "closed": 1,
- "total": 4,
- },
- "stats": undefined,
- "title": "12.4",
- "webPath": undefined,
- "webUrl": "/releases-namespace/releases-project/-/milestones/2",
- },
- Object {
"description": "The 12.3 milestone",
"id": "gid://gitlab/Milestone/123",
"issueStats": Object {
@@ -112,6 +100,18 @@ Object {
"webPath": undefined,
"webUrl": "/releases-namespace/releases-project/-/milestones/1",
},
+ Object {
+ "description": "The 12.4 milestone",
+ "id": "gid://gitlab/Milestone/124",
+ "issueStats": Object {
+ "closed": 1,
+ "total": 4,
+ },
+ "stats": undefined,
+ "title": "12.4",
+ "webPath": undefined,
+ "webUrl": "/releases-namespace/releases-project/-/milestones/2",
+ },
],
"name": "The first release",
"releasedAt": "2018-12-10T00:00:00Z",
@@ -217,18 +217,6 @@ Object {
],
"milestones": Array [
Object {
- "description": "The 12.4 milestone",
- "id": "gid://gitlab/Milestone/124",
- "issueStats": Object {
- "closed": 1,
- "total": 4,
- },
- "stats": undefined,
- "title": "12.4",
- "webPath": undefined,
- "webUrl": "/releases-namespace/releases-project/-/milestones/2",
- },
- Object {
"description": "The 12.3 milestone",
"id": "gid://gitlab/Milestone/123",
"issueStats": Object {
@@ -240,6 +228,18 @@ Object {
"webPath": undefined,
"webUrl": "/releases-namespace/releases-project/-/milestones/1",
},
+ Object {
+ "description": "The 12.4 milestone",
+ "id": "gid://gitlab/Milestone/124",
+ "issueStats": Object {
+ "closed": 1,
+ "total": 4,
+ },
+ "stats": undefined,
+ "title": "12.4",
+ "webPath": undefined,
+ "webUrl": "/releases-namespace/releases-project/-/milestones/2",
+ },
],
"name": "The first release",
"releasedAt": "2018-12-10T00:00:00Z",
diff --git a/spec/frontend/releases/components/app_edit_new_spec.js b/spec/frontend/releases/components/app_edit_new_spec.js
index 1d409b5b590..828d1b46a80 100644
--- a/spec/frontend/releases/components/app_edit_new_spec.js
+++ b/spec/frontend/releases/components/app_edit_new_spec.js
@@ -71,7 +71,7 @@ describe('Release edit/new component', () => {
await wrapper.vm.$nextTick();
- wrapper.element.querySelectorAll('input').forEach(input => jest.spyOn(input, 'focus'));
+ wrapper.element.querySelectorAll('input').forEach((input) => jest.spyOn(input, 'focus'));
};
beforeEach(() => {
@@ -104,7 +104,7 @@ describe('Release edit/new component', () => {
const firstEnabledInput = wrapper.element.querySelector('input:enabled');
const allInputs = wrapper.element.querySelectorAll('input');
- allInputs.forEach(input => {
+ allInputs.forEach((input) => {
const expectedFocusCalls = input === firstEnabledInput ? 1 : 0;
expect(input.focus).toHaveBeenCalledTimes(expectedFocusCalls);
});
@@ -152,7 +152,7 @@ describe('Release edit/new component', () => {
beforeEach(async () => {
commonUtils.getParameterByName = jest
.fn()
- .mockImplementation(paramToGet => ({ [BACK_URL_PARAM]: backUrl }[paramToGet]));
+ .mockImplementation((paramToGet) => ({ [BACK_URL_PARAM]: backUrl }[paramToGet]));
await factory();
});
diff --git a/spec/frontend/releases/components/app_index_spec.js b/spec/frontend/releases/components/app_index_spec.js
index 9f1577c2f1e..1481dd30fd4 100644
--- a/spec/frontend/releases/components/app_index_spec.js
+++ b/spec/frontend/releases/components/app_index_spec.js
@@ -13,7 +13,7 @@ import ReleasesPagination from '~/releases/components/releases_pagination.vue';
jest.mock('~/lib/utils/common_utils', () => ({
...jest.requireActual('~/lib/utils/common_utils'),
- getParameterByName: jest.fn().mockImplementation(paramName => {
+ getParameterByName: jest.fn().mockImplementation((paramName) => {
return `${paramName}_param_value`;
}),
}));
@@ -28,7 +28,7 @@ describe('Releases App ', () => {
let wrapper;
let fetchReleaseSpy;
- const paginatedReleases = rge(21).map(index => ({
+ const paginatedReleases = rge(21).map((index) => ({
...convertObjectPropsToCamelCase(release, { deep: true }),
tagName: `${index}.00`,
}));
@@ -98,10 +98,10 @@ describe('Releases App ', () => {
});
it('renders loading icon', () => {
- expect(wrapper.contains('.js-loading')).toBe(true);
- expect(wrapper.contains('.js-empty-state')).toBe(false);
- expect(wrapper.contains('.js-success-state')).toBe(false);
- expect(wrapper.contains(ReleasesPagination)).toBe(false);
+ expect(wrapper.find('.js-loading').exists()).toBe(true);
+ expect(wrapper.find('.js-empty-state').exists()).toBe(false);
+ expect(wrapper.find('.js-success-state').exists()).toBe(false);
+ expect(wrapper.find(ReleasesPagination).exists()).toBe(false);
});
});
@@ -115,10 +115,10 @@ describe('Releases App ', () => {
});
it('renders success state', () => {
- expect(wrapper.contains('.js-loading')).toBe(false);
- expect(wrapper.contains('.js-empty-state')).toBe(false);
- expect(wrapper.contains('.js-success-state')).toBe(true);
- expect(wrapper.contains(ReleasesPagination)).toBe(true);
+ expect(wrapper.find('.js-loading').exists()).toBe(false);
+ expect(wrapper.find('.js-empty-state').exists()).toBe(false);
+ expect(wrapper.find('.js-success-state').exists()).toBe(true);
+ expect(wrapper.find(ReleasesPagination).exists()).toBe(true);
});
});
@@ -132,10 +132,10 @@ describe('Releases App ', () => {
});
it('renders success state', () => {
- expect(wrapper.contains('.js-loading')).toBe(false);
- expect(wrapper.contains('.js-empty-state')).toBe(false);
- expect(wrapper.contains('.js-success-state')).toBe(true);
- expect(wrapper.contains(ReleasesPagination)).toBe(true);
+ expect(wrapper.find('.js-loading').exists()).toBe(false);
+ expect(wrapper.find('.js-empty-state').exists()).toBe(false);
+ expect(wrapper.find('.js-success-state').exists()).toBe(true);
+ expect(wrapper.find(ReleasesPagination).exists()).toBe(true);
});
});
@@ -147,9 +147,9 @@ describe('Releases App ', () => {
});
it('renders empty state', () => {
- expect(wrapper.contains('.js-loading')).toBe(false);
- expect(wrapper.contains('.js-empty-state')).toBe(true);
- expect(wrapper.contains('.js-success-state')).toBe(false);
+ expect(wrapper.find('.js-loading').exists()).toBe(false);
+ expect(wrapper.find('.js-empty-state').exists()).toBe(true);
+ expect(wrapper.find('.js-success-state').exists()).toBe(false);
});
});
diff --git a/spec/frontend/releases/components/app_show_spec.js b/spec/frontend/releases/components/app_show_spec.js
index 181fa0150f1..b1f94ca9859 100644
--- a/spec/frontend/releases/components/app_show_spec.js
+++ b/spec/frontend/releases/components/app_show_spec.js
@@ -17,7 +17,7 @@ describe('Release show component', () => {
release = convertObjectPropsToCamelCase(originalRelease);
});
- const factory = state => {
+ const factory = (state) => {
actions = {
fetchRelease: jest.fn(),
};
diff --git a/spec/frontend/releases/components/asset_links_form_spec.js b/spec/frontend/releases/components/asset_links_form_spec.js
index 6794a56debc..2b2ad0150ab 100644
--- a/spec/frontend/releases/components/asset_links_form_spec.js
+++ b/spec/frontend/releases/components/asset_links_form_spec.js
@@ -30,7 +30,7 @@ describe('Release edit component', () => {
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);
+ state.release.assets.links = state.release.assets.links.filter((l) => l.id !== linkId);
}),
};
@@ -104,7 +104,7 @@ describe('Release edit component', () => {
expect(actions.updateAssetLinkUrl).not.toHaveBeenCalled();
};
- const dispatchKeydowEvent = eventParams => {
+ const dispatchKeydowEvent = (eventParams) => {
const event = new KeyboardEvent('keydown', eventParams);
input.dispatchEvent(event);
@@ -162,7 +162,7 @@ describe('Release edit component', () => {
expect(actions.updateAssetLinkUrl).not.toHaveBeenCalled();
};
- const dispatchKeydowEvent = eventParams => {
+ const dispatchKeydowEvent = (eventParams) => {
const event = new KeyboardEvent('keydown', eventParams);
input.dispatchEvent(event);
diff --git a/spec/frontend/releases/components/issuable_stats_spec.js b/spec/frontend/releases/components/issuable_stats_spec.js
index d8211ec2adc..8fc0779da14 100644
--- a/spec/frontend/releases/components/issuable_stats_spec.js
+++ b/spec/frontend/releases/components/issuable_stats_spec.js
@@ -7,7 +7,7 @@ describe('~/releases/components/issuable_stats.vue', () => {
let wrapper;
let defaultProps;
- const createComponent = propUpdates => {
+ const createComponent = (propUpdates) => {
wrapper = mount(IssuableStats, {
propsData: {
...defaultProps,
diff --git a/spec/frontend/releases/components/release_block_assets_spec.js b/spec/frontend/releases/components/release_block_assets_spec.js
index 126ca27e8a6..77bd35f94aa 100644
--- a/spec/frontend/releases/components/release_block_assets_spec.js
+++ b/spec/frontend/releases/components/release_block_assets_spec.js
@@ -26,8 +26,8 @@ describe('Release block assets', () => {
});
};
- const findSectionHeading = type =>
- wrapper.findAll('h5').filter(h5 => h5.text() === sections[type]);
+ const findSectionHeading = (type) =>
+ wrapper.findAll('h5').filter((h5) => h5.text() === sections[type]);
beforeEach(() => {
defaultProps = { assets: convertObjectPropsToCamelCase(assets, { deep: true }) };
@@ -53,7 +53,7 @@ describe('Release block assets', () => {
});
it('renders sources with the expected text and URL', () => {
- defaultProps.assets.sources.forEach(s => {
+ defaultProps.assets.sources.forEach((s) => {
const sourceLink = wrapper.find(`li>a[href="${s.url}"]`);
expect(sourceLink.exists()).toBe(true);
@@ -62,7 +62,7 @@ describe('Release block assets', () => {
});
it('renders a heading for each assets type (except sources)', () => {
- Object.keys(sections).forEach(type => {
+ Object.keys(sections).forEach((type) => {
const sectionHeadings = findSectionHeading(type);
expect(sectionHeadings).toHaveLength(1);
@@ -70,7 +70,7 @@ describe('Release block assets', () => {
});
it('renders asset links with the expected text and URL', () => {
- defaultProps.assets.links.forEach(l => {
+ defaultProps.assets.links.forEach((l) => {
const sourceLink = wrapper.find(`li>a[href="${l.directAssetUrl}"]`);
expect(sourceLink.exists()).toBe(true);
@@ -84,7 +84,7 @@ describe('Release block assets', () => {
beforeEach(() => {
defaultProps.assets.links = defaultProps.assets.links.filter(
- l => l.linkType !== typeToExclude,
+ (l) => l.linkType !== typeToExclude,
);
createComponent(defaultProps);
});
@@ -98,7 +98,7 @@ describe('Release block assets', () => {
describe('sources', () => {
const testSources = ({ shouldSourcesBeRendered }) => {
- assets.sources.forEach(s => {
+ assets.sources.forEach((s) => {
expect(wrapper.find(`a[href="${s.url}"]`).exists()).toBe(shouldSourcesBeRendered);
});
};
diff --git a/spec/frontend/releases/components/release_block_milestone_info_spec.js b/spec/frontend/releases/components/release_block_milestone_info_spec.js
index bb34693c757..4eb15e9da12 100644
--- a/spec/frontend/releases/components/release_block_milestone_info_spec.js
+++ b/spec/frontend/releases/components/release_block_milestone_info_spec.js
@@ -12,7 +12,7 @@ describe('Release block milestone info', () => {
let wrapper;
let milestones;
- const factory = props => {
+ const factory = (props) => {
wrapper = mount(ReleaseBlockMilestoneInfo, {
propsData: props,
});
@@ -54,22 +54,10 @@ describe('Release block milestone info', () => {
});
it('renders a list of links to all associated milestones', () => {
- // The API currently returns the milestones in a non-deterministic order,
- // which causes the frontend fixture used by this test to return the
- // milestones in one order locally and a different order in the CI pipeline.
- // This is a bug and is tracked here: https://gitlab.com/gitlab-org/gitlab/-/issues/259012
- // When this bug is fixed this expectation should be updated to
- // assert the expected order.
- const containerText = trimText(milestoneListContainer().text());
- expect(
- containerText.includes('Milestones 12.4 • 12.3') ||
- containerText.includes('Milestones 12.3 • 12.4'),
- ).toBe(true);
+ expect(milestoneListContainer().text()).toMatchInterpolatedText('Milestones 12.3 • 12.4');
milestones.forEach((m, i) => {
- const milestoneLink = milestoneListContainer()
- .findAll(GlLink)
- .at(i);
+ const milestoneLink = milestoneListContainer().findAll(GlLink).at(i);
expect(milestoneLink.text()).toBe(m.title);
expect(milestoneLink.attributes('href')).toBe(m.webUrl);
@@ -108,19 +96,17 @@ describe('Release block milestone info', () => {
});
}
- fullListString = lotsOfMilestones.map(m => m.title).join(' • ');
+ fullListString = lotsOfMilestones.map((m) => m.title).join(' • ');
abbreviatedListString = lotsOfMilestones
.slice(0, MAX_MILESTONES_TO_DISPLAY)
- .map(m => m.title)
+ .map((m) => m.title)
.join(' • ');
return factory({ milestones: lotsOfMilestones });
});
const clickShowMoreFewerButton = () => {
- milestoneListContainer()
- .find(GlButton)
- .trigger('click');
+ milestoneListContainer().find(GlButton).trigger('click');
return wrapper.vm.$nextTick();
};
@@ -161,7 +147,7 @@ describe('Release block milestone info', () => {
/** Ensures we don't have any issues with dividing by zero when computing percentages */
describe('when all issue counts are zero', () => {
beforeEach(() => {
- milestones = milestones.map(m => ({
+ milestones = milestones.map((m) => ({
...m,
issueStats: {
...m.issueStats,
@@ -178,7 +164,7 @@ describe('Release block milestone info', () => {
describe('if the API response is missing the "issue_stats" property', () => {
beforeEach(() => {
- milestones = milestones.map(m => ({
+ milestones = milestones.map((m) => ({
...m,
issueStats: undefined,
}));
@@ -199,7 +185,7 @@ describe('Release block milestone info', () => {
describe('if the API response includes the "mr_stats" property', () => {
beforeEach(() => {
- milestones = milestones.map(m => ({
+ milestones = milestones.map((m) => ({
...m,
mrStats: {
total: 15,
diff --git a/spec/frontend/releases/components/releases_pagination_graphql_spec.js b/spec/frontend/releases/components/releases_pagination_graphql_spec.js
index bba5e532e5e..cee5e72e1c0 100644
--- a/spec/frontend/releases/components/releases_pagination_graphql_spec.js
+++ b/spec/frontend/releases/components/releases_pagination_graphql_spec.js
@@ -24,7 +24,7 @@ describe('~/releases/components/releases_pagination_graphql.vue', () => {
const projectPath = 'my/project';
- const createComponent = pageInfo => {
+ const createComponent = (pageInfo) => {
listModule = createListModule({ projectPath });
listModule.state.graphQlPageInfo = pageInfo;
@@ -72,7 +72,7 @@ describe('~/releases/components/releases_pagination_graphql.vue', () => {
});
it('does not render anything', () => {
- expect(wrapper.isEmpty()).toBe(true);
+ expect(wrapper.html()).toBe('');
});
});
diff --git a/spec/frontend/releases/components/releases_pagination_rest_spec.js b/spec/frontend/releases/components/releases_pagination_rest_spec.js
index 59c0c31413a..b015792c96b 100644
--- a/spec/frontend/releases/components/releases_pagination_rest_spec.js
+++ b/spec/frontend/releases/components/releases_pagination_rest_spec.js
@@ -17,7 +17,7 @@ describe('~/releases/components/releases_pagination_rest.vue', () => {
const projectId = 19;
- const createComponent = pageInfo => {
+ const createComponent = (pageInfo) => {
listModule = createListModule({ projectId });
listModule.state.restPageInfo = pageInfo;
diff --git a/spec/frontend/releases/components/releases_pagination_spec.js b/spec/frontend/releases/components/releases_pagination_spec.js
index 2466fb53a68..1d47da31f38 100644
--- a/spec/frontend/releases/components/releases_pagination_spec.js
+++ b/spec/frontend/releases/components/releases_pagination_spec.js
@@ -10,7 +10,7 @@ localVue.use(Vuex);
describe('~/releases/components/releases_pagination.vue', () => {
let wrapper;
- const createComponent = useGraphQLEndpoint => {
+ const createComponent = (useGraphQLEndpoint) => {
const store = new Vuex.Store({
getters: {
useGraphQLEndpoint: () => useGraphQLEndpoint,
diff --git a/spec/frontend/releases/components/tag_field_new_spec.js b/spec/frontend/releases/components/tag_field_new_spec.js
index b6ebc496f33..eba0e286b27 100644
--- a/spec/frontend/releases/components/tag_field_new_spec.js
+++ b/spec/frontend/releases/components/tag_field_new_spec.js
@@ -83,7 +83,7 @@ describe('releases/components/tag_field_new', () => {
* @param {'shown' | 'hidden'} state The expected state of the validation message.
* Should be passed either 'shown' or 'hidden'
*/
- const expectValidationMessageToBe = state => {
+ const expectValidationMessageToBe = (state) => {
return wrapper.vm.$nextTick().then(() => {
expect(findTagNameFormGroup().element).toHaveClass(
state === 'shown' ? 'is-invalid' : 'is-valid',
diff --git a/spec/frontend/releases/stores/modules/detail/actions_spec.js b/spec/frontend/releases/stores/modules/detail/actions_spec.js
index abd0db6a589..396e7bd8745 100644
--- a/spec/frontend/releases/stores/modules/detail/actions_spec.js
+++ b/spec/frontend/releases/stores/modules/detail/actions_spec.js
@@ -435,7 +435,7 @@ describe('Release detail actions', () => {
expect(api.deleteReleaseLink).toHaveBeenCalledTimes(
getters.releaseLinksToDelete.length,
);
- getters.releaseLinksToDelete.forEach(link => {
+ getters.releaseLinksToDelete.forEach((link) => {
expect(api.deleteReleaseLink).toHaveBeenCalledWith(
state.projectId,
state.tagName,
@@ -446,7 +446,7 @@ describe('Release detail actions', () => {
expect(api.createReleaseLink).toHaveBeenCalledTimes(
getters.releaseLinksToCreate.length,
);
- getters.releaseLinksToCreate.forEach(link => {
+ getters.releaseLinksToCreate.forEach((link) => {
expect(api.createReleaseLink).toHaveBeenCalledWith(
state.projectId,
state.tagName,
diff --git a/spec/frontend/releases/stores/modules/list/helpers.js b/spec/frontend/releases/stores/modules/list/helpers.js
index 3ca255eaf8c..3913eba31b8 100644
--- a/spec/frontend/releases/stores/modules/list/helpers.js
+++ b/spec/frontend/releases/stores/modules/list/helpers.js
@@ -1,5 +1,5 @@
import state from '~/releases/stores/modules/list/state';
-export const resetStore = store => {
+export const resetStore = (store) => {
store.replaceState(state());
};