entities.ts 2.5 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
export const mr: RestMr = {
25 26 27
  ...issue,
  id: 2,
  iid: 2000,
28
  web_url: 'https://gitlab.example.com/group/project/merge_requests/2000',
29 30 31
  references: {
    full: 'gitlab-org/gitlab!2000',
  },
32
  sha: '69ad609e8891b8aa3db85a35cd2c5747705bd76a',
33 34
  source_project_id: 9999,
  target_project_id: 9999,
35
  source_branch: 'feature-a',
36 37
};

38 39 40 41 42 43
export const diffFile: RestDiffFile = {
  old_path: 'old_file.js',
  new_path: 'new_file.js',
  new_file: false,
  deleted_file: false,
  renamed_file: true,
44
  diff: '@@ -0,0 +1,7 @@\n+new file 2\n+\n+12\n+34\n+56\n+\n+,,,\n',
45 46 47 48 49
};

export const mrVersion: RestMrVersion = {
  base_commit_sha: 'aaaaaaaa',
  head_commit_sha: 'bbbbbbbb',
T
Tomas Vik 已提交
50
  start_commit_sha: 'cccccccc',
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
  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',
};
68

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

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

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',
  },
94
  wikiEnabled: false,
95 96 97
};

export const project = new GitLabProject(gqlProject);