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-02-18 13:34:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-02-18 13:34:06 +0300
commit859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch)
treed7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/frontend/snippets/test_utils.js
parent446d496a6d000c73a304be52587cd9bbc7493136 (diff)
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/frontend/snippets/test_utils.js')
-rw-r--r--spec/frontend/snippets/test_utils.js55
1 files changed, 55 insertions, 0 deletions
diff --git a/spec/frontend/snippets/test_utils.js b/spec/frontend/snippets/test_utils.js
index 86262723157..8ba5a2fe5dc 100644
--- a/spec/frontend/snippets/test_utils.js
+++ b/spec/frontend/snippets/test_utils.js
@@ -1,3 +1,4 @@
+import { TEST_HOST } from 'helpers/test_constants';
import {
SNIPPET_BLOB_ACTION_CREATE,
SNIPPET_BLOB_ACTION_UPDATE,
@@ -8,6 +9,51 @@ import {
const CONTENT_1 = 'Lorem ipsum dolar\nSit amit\n\nGoodbye!\n';
const CONTENT_2 = 'Lorem ipsum dolar sit amit.\n\nGoodbye!\n';
+export const createGQLSnippet = () => ({
+ __typename: 'Snippet',
+ id: 7,
+ title: 'Snippet Title',
+ description: 'Lorem ipsum snippet desc',
+ descriptionHtml: '<p>Lorem ipsum snippet desc</p>',
+ createdAt: new Date(Date.now() - 1e6),
+ updatedAt: new Date(Date.now() - 1e3),
+ httpUrlToRepo: `${TEST_HOST}/repo`,
+ sshUrlToRepo: 'ssh://ssh.test/repo',
+ blobs: [],
+ userPermissions: {
+ __typename: 'SnippetPermissions',
+ adminSnippet: true,
+ updateSnippet: true,
+ },
+ project: {
+ __typename: 'Project',
+ fullPath: 'group/project',
+ webUrl: `${TEST_HOST}/group/project`,
+ },
+ author: {
+ __typename: 'User',
+ id: 1,
+ avatarUrl: `${TEST_HOST}/avatar.png`,
+ name: 'root',
+ username: 'root',
+ webUrl: `${TEST_HOST}/root`,
+ status: {
+ __typename: 'UserStatus',
+ emoji: '',
+ message: '',
+ },
+ },
+});
+
+export const createGQLSnippetsQueryResponse = (snippets) => ({
+ data: {
+ snippets: {
+ __typename: 'SnippetConnection',
+ nodes: snippets,
+ },
+ },
+});
+
export const testEntries = {
created: {
id: 'blob_1',
@@ -56,6 +102,15 @@ export const testEntries = {
content: CONTENT_2,
},
},
+ empty: {
+ id: 'empty',
+ diff: {
+ action: SNIPPET_BLOB_ACTION_CREATE,
+ filePath: '',
+ previousPath: '',
+ content: '',
+ },
+ },
};
export const createBlobFromTestEntry = ({ diff, origContent }, isOrig = false) => ({