Welcome to mirror list, hosted at ThFree Co, Russian Federation.

fixtures.js « graphql « import_groups « import_entities « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: edc2d1a2381835871f693a563ef20d4f6e53c729 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import { STATUSES } from '~/import_entities/constants';
import { clientTypenames } from '~/import_entities/import_groups/graphql/client_factory';

export const generateFakeEntry = ({ id, status, hasFailures = false, message, ...rest }) => ({
  __typename: clientTypenames.BulkImportSourceGroup,
  webUrl: `https://fake.host/${id}`,
  fullPath: `fake_group_${id}`,
  fullName: `fake_name_${id}`,
  lastImportTarget: {
    id,
    targetNamespace: 'root',
    newName: `group${id}`,
  },
  id,
  progress:
    status === STATUSES.NONE || status === STATUSES.PENDING
      ? null
      : {
          __typename: clientTypenames.BulkImportProgress,
          id,
          status,
          hasFailures,
          message: message || '',
        },
  ...rest,
});

export const statusEndpointFixture = {
  importable_data: [
    {
      id: 2595438,
      full_name: 'AutoBreakfast',
      full_path: 'auto-breakfast',
      web_url: 'https://gitlab.com/groups/auto-breakfast',
    },
    {
      id: 4347861,
      full_name: 'GitLab Data',
      full_path: 'gitlab-data',
      web_url: 'https://gitlab.com/groups/gitlab-data',
    },
    {
      id: 5723700,
      full_name: 'GitLab Services',
      full_path: 'gitlab-services',
      web_url: 'https://gitlab.com/groups/gitlab-services',
    },
    {
      id: 349181,
      full_name: 'GitLab-examples',
      full_path: 'gitlab-examples',
      web_url: 'https://gitlab.com/groups/gitlab-examples',
    },
  ],
  version_validation: {
    features: {
      project_migration: { available: false, min_version: '14.8.0' },
      source_instance_version: '14.6.0',
    },
  },
};

const makeGroupMock = ({ id, fullPath }) => ({
  id,
  fullPath,
  name: fullPath,
  visibility: 'public',
  webUrl: `http://gdk.test:3000/groups/${fullPath}`,
  __typename: 'Group',
});

export const AVAILABLE_NAMESPACES = [
  makeGroupMock({ id: 24, fullPath: 'Commit451' }),
  makeGroupMock({ id: 22, fullPath: 'gitlab-org' }),
  makeGroupMock({ id: 23, fullPath: 'gnuwget' }),
  makeGroupMock({ id: 25, fullPath: 'jashkenas' }),
];

export const availableNamespacesFixture = {
  data: {
    currentUser: {
      id: 'gid://gitlab/User/1',
      groups: {
        nodes: AVAILABLE_NAMESPACES,
        __typename: 'GroupConnection',
      },
      namespace: {
        id: 'gid://gitlab/Namespaces::UserNamespace/1',
        fullPath: 'root',
        __typename: 'Namespace',
      },
      __typename: 'UserCore',
    },
  },
};