entities.ts 2.3 KB
Newer Older
1
import { WrappedRepository } from '../git/wrapped_repository';
2
import { CustomQueryType } from '../gitlab/custom_query_type';
3 4
import { GitLabProject } from '../gitlab/gitlab_project';
import { GqlProject } from '../gitlab/graphql/shared';
5

6
export const issue: RestIssuable = {
7 8 9 10
  id: 1,
  iid: 1000,
  title: 'Issuable Title',
  project_id: 9999,
11
  web_url: 'https://gitlab.example.com/group/project/issues/1000',
12 13 14 15 16
  author: {
    avatar_url:
      'https://secure.gravatar.com/avatar/6042a9152ada74d9fb6a0cdce895337e?s=80&d=identicon',
    name: 'Tomas Vik',
  },
17 18 19
  references: {
    full: 'gitlab-org/gitlab#1000',
  },
20 21
  severity: 'severityLevel1',
  name: 'Issuable Name',
22 23
};

24 25 26 27
export const mr: RestIssuable = {
  ...issue,
  id: 2,
  iid: 2000,
28
  web_url: 'https://gitlab.example.com/group/project/merge_requests/2000',
29 30 31 32 33
  references: {
    full: 'gitlab-org/gitlab!2000',
  },
};

34 35 36 37 38 39
export const diffFile: RestDiffFile = {
  old_path: 'old_file.js',
  new_path: 'new_file.js',
  new_file: false,
  deleted_file: false,
  renamed_file: true,
40
  diff: '@@ -0,0 +1,7 @@\n+new file 2\n+\n+12\n+34\n+56\n+\n+,,,\n',
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
};

export const mrVersion: RestMrVersion = {
  base_commit_sha: 'aaaaaaaa',
  head_commit_sha: 'bbbbbbbb',
  diffs: [diffFile],
};

export const customQuery = {
  name: 'Query name',
  type: CustomQueryType.ISSUE,
  maxResults: 10,
  scope: 'all',
  state: 'closed',
  wip: 'no',
  confidential: false,
  excludeSearchIn: 'all',
  orderBy: 'created_at',
  sort: 'desc',
  searchIn: 'all',
  noItemText: 'No item',
};
63

64 65 66 67
export const pipeline: RestPipeline = {
  status: 'success',
  updated_at: '2021-02-12T12:06:17Z',
  id: 123456,
68
  project_id: 567890,
69
  web_url: 'https://example.com/foo/bar/pipelines/46',
70
};
71 72 73 74 75 76

export const repository = ({
  name: 'GitLab Project',
  rootFsPath: '/path/to/repo',
  containsGitLabProject: true,
} as unknown) as WrappedRepository;
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91

export const gqlProject: GqlProject = {
  id: 'gid://gitlab/Project/5261717',
  name: 'gitlab-vscode-extension',
  description: '',
  httpUrlToRepo: 'https://gitlab.com/gitlab-org/gitlab-vscode-extension.git',
  sshUrlToRepo: 'git@gitlab.com:gitlab-org/gitlab-vscode-extension.git',
  fullPath: 'gitlab-org/gitlab-vscode-extension',
  webUrl: 'https://gitlab.com/gitlab-org/gitlab-vscode-extension',
  group: {
    id: 'gid://gitlab/Group/9970',
  },
};

export const project = new GitLabProject(gqlProject);