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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-23 21:11:12 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-23 21:11:12 +0300
commitcfc8827f6bf9573b02401b1908728da3aed96698 (patch)
tree30180d04062db3e56d1cc3772888ff4f15e56c10 /spec/frontend/lib
parenta8b96c3072b3bd4d45e6364931042b350bf7fa2e (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/lib')
-rw-r--r--spec/frontend/lib/utils/apollo_startup_js_link_spec.js10
-rw-r--r--spec/frontend/lib/utils/axios_startup_calls_spec.js16
-rw-r--r--spec/frontend/lib/utils/axios_utils_spec.js4
3 files changed, 15 insertions, 15 deletions
diff --git a/spec/frontend/lib/utils/apollo_startup_js_link_spec.js b/spec/frontend/lib/utils/apollo_startup_js_link_spec.js
index 1d9c5aacf43..78eef205b49 100644
--- a/spec/frontend/lib/utils/apollo_startup_js_link_spec.js
+++ b/spec/frontend/lib/utils/apollo_startup_js_link_spec.js
@@ -1,6 +1,6 @@
import { ApolloLink, Observable } from '@apollo/client/core';
import { StartupJSLink } from '~/lib/utils/apollo_startup_js_link';
-import { HTTP_STATUS_NOT_FOUND } from '~/lib/utils/http_status';
+import { HTTP_STATUS_NOT_FOUND, HTTP_STATUS_OK } from '~/lib/utils/http_status';
describe('StartupJSLink', () => {
const FORWARDED_RESPONSE = { data: 'FORWARDED_RESPONSE' };
@@ -38,7 +38,7 @@ describe('StartupJSLink', () => {
let startupLink;
let link;
- function mockFetchCall(status = 200, response = STARTUP_JS_RESPONSE) {
+ function mockFetchCall(status = HTTP_STATUS_OK, response = STARTUP_JS_RESPONSE) {
const p = {
ok: status >= 200 && status < 300,
status,
@@ -210,7 +210,7 @@ describe('StartupJSLink', () => {
window.gl = {
startup_graphql_calls: [
{
- fetchCall: mockFetchCall(200, ERROR_RESPONSE),
+ fetchCall: mockFetchCall(HTTP_STATUS_OK, ERROR_RESPONSE),
query: STARTUP_JS_QUERY,
variables: { id: 3 },
},
@@ -227,7 +227,7 @@ describe('StartupJSLink', () => {
window.gl = {
startup_graphql_calls: [
{
- fetchCall: mockFetchCall(200, { 'no-data': 'yay' }),
+ fetchCall: mockFetchCall(HTTP_STATUS_OK, { 'no-data': 'yay' }),
query: STARTUP_JS_QUERY,
variables: { id: 3 },
},
@@ -340,7 +340,7 @@ describe('StartupJSLink', () => {
variables: { id: 3 },
},
{
- fetchCall: mockFetchCall(200, STARTUP_JS_RESPONSE_TWO),
+ fetchCall: mockFetchCall(HTTP_STATUS_OK, STARTUP_JS_RESPONSE_TWO),
query: STARTUP_JS_QUERY_TWO,
variables: { id: 3 },
},
diff --git a/spec/frontend/lib/utils/axios_startup_calls_spec.js b/spec/frontend/lib/utils/axios_startup_calls_spec.js
index fc5bd3b811c..4471b781446 100644
--- a/spec/frontend/lib/utils/axios_startup_calls_spec.js
+++ b/spec/frontend/lib/utils/axios_startup_calls_spec.js
@@ -1,7 +1,7 @@
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import setupAxiosStartupCalls from '~/lib/utils/axios_startup_calls';
-import { HTTP_STATUS_BAD_REQUEST } from '~/lib/utils/http_status';
+import { HTTP_STATUS_BAD_REQUEST, HTTP_STATUS_OK } from '~/lib/utils/http_status';
describe('setupAxiosStartupCalls', () => {
const AXIOS_RESPONSE = { text: 'AXIOS_RESPONSE' };
@@ -32,9 +32,9 @@ describe('setupAxiosStartupCalls', () => {
beforeEach(() => {
window.gl = {};
mock = new MockAdapter(axios);
- mock.onGet('/non-startup').reply(200, AXIOS_RESPONSE);
- mock.onGet('/startup').reply(200, AXIOS_RESPONSE);
- mock.onGet('/startup-failing').reply(200, AXIOS_RESPONSE);
+ mock.onGet('/non-startup').reply(HTTP_STATUS_OK, AXIOS_RESPONSE);
+ mock.onGet('/startup').reply(HTTP_STATUS_OK, AXIOS_RESPONSE);
+ mock.onGet('/startup-failing').reply(HTTP_STATUS_OK, AXIOS_RESPONSE);
});
afterEach(() => {
@@ -53,7 +53,7 @@ describe('setupAxiosStartupCalls', () => {
beforeEach(() => {
window.gl.startup_calls = {
'/startup': {
- fetchCall: mockFetchCall(200),
+ fetchCall: mockFetchCall(HTTP_STATUS_OK),
},
'/startup-failing': {
fetchCall: mockFetchCall(HTTP_STATUS_BAD_REQUEST),
@@ -81,7 +81,7 @@ describe('setupAxiosStartupCalls', () => {
const { headers, data, status, statusText } = await axios.get('/startup');
expect(headers).toEqual({ 'content-type': 'application/json' });
- expect(status).toBe(200);
+ expect(status).toBe(HTTP_STATUS_OK);
expect(statusText).toBe('MOCK-FETCH 200');
expect(data).toEqual(STARTUP_JS_RESPONSE);
expect(data).not.toEqual(AXIOS_RESPONSE);
@@ -127,7 +127,7 @@ describe('setupAxiosStartupCalls', () => {
it('removes GitLab Base URL from startup call', async () => {
window.gl.startup_calls = {
'/startup': {
- fetchCall: mockFetchCall(200),
+ fetchCall: mockFetchCall(HTTP_STATUS_OK),
},
};
setupAxiosStartupCalls(axios);
@@ -140,7 +140,7 @@ describe('setupAxiosStartupCalls', () => {
it('sorts the params in the requested API url', async () => {
window.gl.startup_calls = {
'/startup?alpha=true&bravo=true': {
- fetchCall: mockFetchCall(200),
+ fetchCall: mockFetchCall(HTTP_STATUS_OK),
},
};
setupAxiosStartupCalls(axios);
diff --git a/spec/frontend/lib/utils/axios_utils_spec.js b/spec/frontend/lib/utils/axios_utils_spec.js
index 27c580a4d8b..2656fb1d648 100644
--- a/spec/frontend/lib/utils/axios_utils_spec.js
+++ b/spec/frontend/lib/utils/axios_utils_spec.js
@@ -28,8 +28,8 @@ describe('axios_utils', () => {
return axios.waitForAll().finally(() => {
expect(handler).toHaveBeenCalledTimes(2);
- expect(handler.mock.calls[0][0].status).toBe(200);
- expect(handler.mock.calls[1][0].response.status).toBe(500);
+ expect(handler.mock.calls[0][0].status).toBe(HTTP_STATUS_OK);
+ expect(handler.mock.calls[1][0].response.status).toBe(HTTP_STATUS_INTERNAL_SERVER_ERROR);
});
});
});