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-11-09 06:42:22 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-11-09 06:42:22 +0300
commit7dd9256e5eac896fb422566376086a0befc79151 (patch)
treebe65227875ddb0cff4961ae2d97380bbf64dd851 /spec/frontend/graphql_shared
parent2295d352f6073101497f9bf4e4981c7ae72706a3 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/graphql_shared')
-rw-r--r--spec/frontend/graphql_shared/utils_spec.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/spec/frontend/graphql_shared/utils_spec.js b/spec/frontend/graphql_shared/utils_spec.js
index 1732f24eeff..4dffb4dc73a 100644
--- a/spec/frontend/graphql_shared/utils_spec.js
+++ b/spec/frontend/graphql_shared/utils_spec.js
@@ -1,6 +1,7 @@
import {
isGid,
getIdFromGraphQLId,
+ getZeroBasedIdFromGraphQLId,
convertToGraphQLId,
convertToGraphQLIds,
convertFromGraphQLIds,
@@ -52,6 +53,10 @@ describe('getIdFromGraphQLId', () => {
output: null,
},
{
+ input: 'gid://gitlab/Environments/0',
+ output: null,
+ },
+ {
input: 'gid://gitlab/Environments/123',
output: 123,
},
@@ -66,6 +71,55 @@ describe('getIdFromGraphQLId', () => {
});
});
+describe('getZeroBasedIdFromGraphQLId', () => {
+ [
+ {
+ input: '',
+ output: null,
+ },
+ {
+ input: null,
+ output: null,
+ },
+ {
+ input: 2,
+ output: 2,
+ },
+ {
+ input: 'gid://',
+ output: null,
+ },
+ {
+ input: 'gid://gitlab/',
+ output: null,
+ },
+ {
+ input: 'gid://gitlab/Environments',
+ output: null,
+ },
+ {
+ input: 'gid://gitlab/Environments/',
+ output: null,
+ },
+ {
+ input: 'gid://gitlab/Environments/0',
+ output: 0,
+ },
+ {
+ input: 'gid://gitlab/Environments/123',
+ output: 123,
+ },
+ {
+ input: 'gid://gitlab/DesignManagement::Version/2',
+ output: 2,
+ },
+ ].forEach(({ input, output }) => {
+ it(`getZeroBasedIdFromGraphQLId returns ${output} when passed ${input}`, () => {
+ expect(getZeroBasedIdFromGraphQLId(input)).toBe(output);
+ });
+ });
+});
+
describe('convertToGraphQLId', () => {
it('combines $type and $id into $result', () => {
expect(convertToGraphQLId(mockType, mockId)).toBe(mockGid);