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>2021-04-26 21:09:45 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-26 21:09:45 +0300
commite7e40d45b066139707b3b851c6004e075da5226b (patch)
treecc99f48e2aaedbe9e8dac53fa4ca8d8f6f270bb4 /spec/frontend/releases
parentaad3ac9e5e59d47e389ff387e9fc2ae3a008de33 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/releases')
-rw-r--r--spec/frontend/releases/__snapshots__/util_spec.js.snap62
-rw-r--r--spec/frontend/releases/util_spec.js58
2 files changed, 120 insertions, 0 deletions
diff --git a/spec/frontend/releases/__snapshots__/util_spec.js.snap b/spec/frontend/releases/__snapshots__/util_spec.js.snap
index c9f84be97c4..cad593b76ea 100644
--- a/spec/frontend/releases/__snapshots__/util_spec.js.snap
+++ b/spec/frontend/releases/__snapshots__/util_spec.js.snap
@@ -129,6 +129,68 @@ Object {
}
`;
+exports[`releases/util.js convertOneReleaseForEditingGraphQLResponse matches snapshot 1`] = `
+Object {
+ "data": Object {
+ "_links": Object {
+ "self": "http://localhost/releases-namespace/releases-project/-/releases/v1.1",
+ "selfUrl": "http://localhost/releases-namespace/releases-project/-/releases/v1.1",
+ },
+ "assets": Object {
+ "count": undefined,
+ "links": Array [
+ Object {
+ "id": "gid://gitlab/Releases::Link/13",
+ "linkType": "image",
+ "name": "Image",
+ "url": "https://example.com/image",
+ },
+ Object {
+ "id": "gid://gitlab/Releases::Link/12",
+ "linkType": "package",
+ "name": "Package",
+ "url": "https://example.com/package",
+ },
+ Object {
+ "id": "gid://gitlab/Releases::Link/11",
+ "linkType": "runbook",
+ "name": "Runbook",
+ "url": "http://localhost/releases-namespace/releases-project/runbook",
+ },
+ Object {
+ "id": "gid://gitlab/Releases::Link/10",
+ "linkType": "other",
+ "name": "linux-amd64 binaries",
+ "url": "https://downloads.example.com/bin/gitlab-linux-amd64",
+ },
+ ],
+ "sources": Array [],
+ },
+ "author": undefined,
+ "description": "Best. Release. **Ever.** :rocket:",
+ "evidences": Array [],
+ "milestones": Array [
+ Object {
+ "issueStats": Object {},
+ "stats": undefined,
+ "title": "12.3",
+ "webPath": undefined,
+ "webUrl": undefined,
+ },
+ Object {
+ "issueStats": Object {},
+ "stats": undefined,
+ "title": "12.4",
+ "webPath": undefined,
+ "webUrl": undefined,
+ },
+ ],
+ "name": "The first release",
+ "tagName": "v1.1",
+ },
+}
+`;
+
exports[`releases/util.js convertOneReleaseGraphQLResponse matches snapshot 1`] = `
Object {
"data": Object {
diff --git a/spec/frontend/releases/util_spec.js b/spec/frontend/releases/util_spec.js
index fd00a524628..34f5200c617 100644
--- a/spec/frontend/releases/util_spec.js
+++ b/spec/frontend/releases/util_spec.js
@@ -14,6 +14,9 @@ const originalAllReleasesQueryResponse = getJSONFixture(
const originalOneReleaseQueryResponse = getJSONFixture(
'graphql/releases/queries/one_release.query.graphql.json',
);
+const originalOneReleaseForEditingQueryResponse = getJSONFixture(
+ 'graphql/releases/queries/one_release_for_editing.query.graphql.json',
+);
describe('releases/util.js', () => {
describe('releaseToApiJson', () => {
@@ -135,6 +138,26 @@ describe('releases/util.js', () => {
expect(convertedRelease.assets.links[0].linkType).toBeUndefined();
});
+
+ it('handles assets that have no links', () => {
+ expect(convertedRelease.assets.links[0]).not.toBeUndefined();
+
+ delete releaseFromResponse.assets.links;
+
+ convertedRelease = convertGraphQLRelease(releaseFromResponse);
+
+ expect(convertedRelease.assets.links).toEqual([]);
+ });
+
+ it('handles assets that have no sources', () => {
+ expect(convertedRelease.assets.sources[0]).not.toBeUndefined();
+
+ delete releaseFromResponse.assets.sources;
+
+ convertedRelease = convertGraphQLRelease(releaseFromResponse);
+
+ expect(convertedRelease.assets.sources).toEqual([]);
+ });
});
describe('_links', () => {
@@ -160,6 +183,33 @@ describe('releases/util.js', () => {
expect(convertedRelease.commit).toBeUndefined();
});
});
+
+ describe('milestones', () => {
+ it("handles releases that don't have any milestone stats", () => {
+ expect(convertedRelease.milestones[0].issueStats).not.toBeUndefined();
+
+ releaseFromResponse.milestones.nodes = releaseFromResponse.milestones.nodes.map((n) => ({
+ ...n,
+ stats: undefined,
+ }));
+
+ convertedRelease = convertGraphQLRelease(releaseFromResponse);
+
+ expect(convertedRelease.milestones[0].issueStats).toEqual({});
+ });
+ });
+
+ describe('evidences', () => {
+ it("handles releases that don't have any evidences", () => {
+ expect(convertedRelease.evidences).not.toBeUndefined();
+
+ delete releaseFromResponse.evidences;
+
+ convertedRelease = convertGraphQLRelease(releaseFromResponse);
+
+ expect(convertedRelease.evidences).toEqual([]);
+ });
+ });
});
describe('convertAllReleasesGraphQLResponse', () => {
@@ -173,4 +223,12 @@ describe('releases/util.js', () => {
expect(convertOneReleaseGraphQLResponse(originalOneReleaseQueryResponse)).toMatchSnapshot();
});
});
+
+ describe('convertOneReleaseForEditingGraphQLResponse', () => {
+ it('matches snapshot', () => {
+ expect(
+ convertOneReleaseGraphQLResponse(originalOneReleaseForEditingQueryResponse),
+ ).toMatchSnapshot();
+ });
+ });
});