summaryrefslogtreecommitdiff
path: root/spec/frontend/crm/mock_data.js
blob: f7af2ccdb72c62a96b53e429a8651354105ac522 (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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
export const getGroupContactsQueryResponse = {
  data: {
    group: {
      __typename: 'Group',
      id: 'gid://gitlab/Group/26',
      contacts: {
        nodes: [
          {
            __typename: 'CustomerRelationsContact',
            id: 'gid://gitlab/CustomerRelations::Contact/12',
            firstName: 'Marty',
            lastName: 'McFly',
            email: 'example@gitlab.com',
            phone: null,
            description: null,
            organization: {
              __typename: 'CustomerRelationsOrganization',
              id: 'gid://gitlab/CustomerRelations::Organization/2',
              name: 'Tech Giant Inc',
            },
          },
          {
            __typename: 'CustomerRelationsContact',
            id: 'gid://gitlab/CustomerRelations::Contact/16',
            firstName: 'Boy',
            lastName: 'George',
            email: null,
            phone: null,
            description: null,
            organization: null,
          },
          {
            __typename: 'CustomerRelationsContact',
            id: 'gid://gitlab/CustomerRelations::Contact/13',
            firstName: 'Jane',
            lastName: 'Doe',
            email: 'jd@gitlab.com',
            phone: '+44 44 4444 4444',
            description: 'Vice President',
            organization: null,
          },
        ],
      },
    },
  },
};

export const getGroupOrganizationsQueryResponse = {
  data: {
    group: {
      __typename: 'Group',
      id: 'gid://gitlab/Group/26',
      organizations: {
        nodes: [
          {
            __typename: 'CustomerRelationsOrganization',
            id: 'gid://gitlab/CustomerRelations::Organization/1',
            name: 'Test Inc',
            defaultRate: 100,
            description: null,
          },
          {
            __typename: 'CustomerRelationsOrganization',
            id: 'gid://gitlab/CustomerRelations::Organization/2',
            name: 'ABC Company',
            defaultRate: 110,
            description: 'VIP',
          },
          {
            __typename: 'CustomerRelationsOrganization',
            id: 'gid://gitlab/CustomerRelations::Organization/3',
            name: 'GitLab',
            defaultRate: 120,
            description: null,
          },
        ],
      },
    },
  },
};

export const createContactMutationResponse = {
  data: {
    customerRelationsContactCreate: {
      __typeName: 'CustomerRelationsContactCreatePayload',
      contact: {
        __typename: 'CustomerRelationsContact',
        id: 'gid://gitlab/CustomerRelations::Contact/1',
        firstName: 'A',
        lastName: 'B',
        email: 'C',
        phone: null,
        description: null,
        organization: null,
      },
      errors: [],
    },
  },
};

export const createContactMutationErrorResponse = {
  data: {
    customerRelationsContactCreate: {
      contact: null,
      errors: ['Phone is invalid.'],
    },
  },
};

export const updateContactMutationResponse = {
  data: {
    customerRelationsContactUpdate: {
      __typeName: 'CustomerRelationsContactCreatePayload',
      contact: {
        __typename: 'CustomerRelationsContact',
        id: 'gid://gitlab/CustomerRelations::Contact/1',
        firstName: 'First',
        lastName: 'Last',
        email: 'email@example.com',
        phone: null,
        description: null,
        organization: null,
      },
      errors: [],
    },
  },
};

export const updateContactMutationErrorResponse = {
  data: {
    customerRelationsContactUpdate: {
      contact: null,
      errors: ['Email is invalid.'],
    },
  },
};

export const createOrganizationMutationResponse = {
  data: {
    customerRelationsOrganizationCreate: {
      __typeName: 'CustomerRelationsOrganizationCreatePayload',
      organization: {
        __typename: 'CustomerRelationsOrganization',
        id: 'gid://gitlab/CustomerRelations::Organization/2',
        name: 'A',
        defaultRate: null,
        description: null,
      },
      errors: [],
    },
  },
};

export const createOrganizationMutationErrorResponse = {
  data: {
    customerRelationsOrganizationCreate: {
      organization: null,
      errors: ['Name cannot be blank.'],
    },
  },
};