summaryrefslogtreecommitdiff
path: root/spec/frontend/alerts_settings/components/mocks/apollo_mock.js
blob: 170af1b5e0c5722b0092716e9a7d8b315bf371e9 (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
const projectPath = '';
export const HTTP_ID = 'gid://gitlab/AlertManagement::HttpIntegration/7';
export const PROMETHEUS_ID = 'gid://gitlab/PrometheusService/12';
export const errorMsg = 'Something went wrong';

export const createHttpVariables = {
  name: 'Test Pre',
  active: true,
  projectPath,
  type: 'HTTP',
};

export const updateHttpVariables = {
  name: 'Test Pre',
  active: true,
  id: HTTP_ID,
  type: 'HTTP',
};

export const createPrometheusVariables = {
  apiUrl: 'https://test-pre.com',
  active: true,
  projectPath,
  type: 'PROMETHEUS',
};

export const updatePrometheusVariables = {
  apiUrl: 'https://test-pre.com',
  active: true,
  id: PROMETHEUS_ID,
  type: 'PROMETHEUS',
};

export const getIntegrationsQueryResponse = {
  data: {
    project: {
      id: '1',
      alertManagementIntegrations: {
        nodes: [
          {
            __typename: 'AlertManagementIntegration',
            id: '37',
            type: 'HTTP',
            active: true,
            name: 'Test 5',
            url:
              'http://127.0.0.1:3000/h5bp/html5-boilerplate/alerts/notify/test-5/d4875758e67334f3.json',
            token: '89eb01df471d990ff5162a1c640408cf',
            apiUrl: null,
          },
          {
            __typename: 'AlertManagementIntegration',
            id: '41',
            type: 'HTTP',
            active: true,
            name: 'Test 9999',
            url:
              'http://127.0.0.1:3000/h5bp/html5-boilerplate/alerts/notify/test-9999/b78a566e1776cfc2.json',
            token: 'f7579aa03844e07af3b1f0fca3f79f81',
            apiUrl: null,
          },
          {
            __typename: 'AlertManagementIntegration',
            id: '40',
            type: 'HTTP',
            active: true,
            name: 'Test 6',
            url:
              'http://127.0.0.1:3000/h5bp/html5-boilerplate/alerts/notify/test-6/3e828ae28a240222.json',
            token: '6536102a607a5dd74fcdde921f2349ee',
            apiUrl: null,
          },
          {
            __typename: 'AlertManagementIntegration',
            id: '12',
            type: 'PROMETHEUS',
            active: false,
            name: 'Prometheus',
            url: 'http://127.0.0.1:3000/h5bp/html5-boilerplate/prometheus/alerts/notify.json',
            token: '256f687c6225aa5d6ee50c3d68120c4c',
            apiUrl: 'https://localhost.ieeeesassadasasa',
          },
        ],
      },
    },
  },
};

export const integrationToDestroy = {
  __typename: 'AlertManagementIntegration',
  id: '37',
  type: 'HTTP',
  active: true,
  name: 'Test 5',
  url: 'http://127.0.0.1:3000/h5bp/html5-boilerplate/alerts/notify/test-5/d4875758e67334f3.json',
  token: '89eb01df471d990ff5162a1c640408cf',
  apiUrl: null,
};

export const destroyIntegrationResponse = {
  data: {
    httpIntegrationDestroy: {
      errors: [],
      integration: {
        __typename: 'AlertManagementHttpIntegration',
        id: '37',
        type: 'HTTP',
        active: true,
        name: 'Test 5',
        url:
          'http://127.0.0.1:3000/h5bp/html5-boilerplate/alerts/notify/test-5/d4875758e67334f3.json',
        token: '89eb01df471d990ff5162a1c640408cf',
        apiUrl: null,
        payloadExample: '{"field": "value"}',
        payloadAttributeMappings: [],
        payloadAlertFields: [],
      },
    },
  },
};

export const destroyIntegrationResponseWithErrors = {
  data: {
    httpIntegrationDestroy: {
      errors: ['Houston, we have a problem'],
      integration: {
        id: '37',
        type: 'HTTP',
        active: true,
        name: 'Test 5',
        url:
          'http://127.0.0.1:3000/h5bp/html5-boilerplate/alerts/notify/test-5/d4875758e67334f3.json',
        token: '89eb01df471d990ff5162a1c640408cf',
        apiUrl: null,
        payloadExample: '{"field": "value"}',
        payloadAttributeMappings: [],
        payloadAlertFields: [],
      },
    },
  },
};