diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 13:49:51 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 13:49:51 +0000 |
commit | 71786ddc8e28fbd3cb3fcc4b3ff15e5962a1c82e (patch) | |
tree | 6a2d93ef3fb2d353bb7739e4b57e6541f51cdd71 /spec/frontend/milestones/components/milestone_combobox_spec.js | |
parent | a7253423e3403b8c08f8a161e5937e1488f5f407 (diff) | |
download | gitlab-ce-71786ddc8e28fbd3cb3fcc4b3ff15e5962a1c82e.tar.gz |
Add latest changes from gitlab-org/gitlab@15-9-stable-eev15.9.0-rc42
Diffstat (limited to 'spec/frontend/milestones/components/milestone_combobox_spec.js')
-rw-r--r-- | spec/frontend/milestones/components/milestone_combobox_spec.js | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/spec/frontend/milestones/components/milestone_combobox_spec.js b/spec/frontend/milestones/components/milestone_combobox_spec.js index c20c51db75e..f8ddca1a2ad 100644 --- a/spec/frontend/milestones/components/milestone_combobox_spec.js +++ b/spec/frontend/milestones/components/milestone_combobox_spec.js @@ -4,6 +4,7 @@ import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; +import { HTTP_STATUS_INTERNAL_SERVER_ERROR, HTTP_STATUS_OK } from '~/lib/utils/http_status'; import { ENTER_KEY } from '~/lib/utils/keys'; import MilestoneCombobox from '~/milestones/components/milestone_combobox.vue'; import createStore from '~/milestones/stores/'; @@ -63,15 +64,15 @@ describe('Milestone combobox component', () => { projectMilestonesApiCallSpy = jest .fn() - .mockReturnValue([200, projectMilestones, { [X_TOTAL_HEADER]: '6' }]); + .mockReturnValue([HTTP_STATUS_OK, projectMilestones, { [X_TOTAL_HEADER]: '6' }]); groupMilestonesApiCallSpy = jest .fn() - .mockReturnValue([200, groupMilestones, { [X_TOTAL_HEADER]: '6' }]); + .mockReturnValue([HTTP_STATUS_OK, groupMilestones, { [X_TOTAL_HEADER]: '6' }]); searchApiCallSpy = jest .fn() - .mockReturnValue([200, projectMilestones, { [X_TOTAL_HEADER]: '6' }]); + .mockReturnValue([HTTP_STATUS_OK, projectMilestones, { [X_TOTAL_HEADER]: '6' }]); mock .onGet(`/api/v4/projects/${projectId}/milestones`) @@ -247,9 +248,11 @@ describe('Milestone combobox component', () => { beforeEach(() => { projectMilestonesApiCallSpy = jest .fn() - .mockReturnValue([200, [], { [X_TOTAL_HEADER]: '0' }]); + .mockReturnValue([HTTP_STATUS_OK, [], { [X_TOTAL_HEADER]: '0' }]); - groupMilestonesApiCallSpy = jest.fn().mockReturnValue([200, [], { [X_TOTAL_HEADER]: '0' }]); + groupMilestonesApiCallSpy = jest + .fn() + .mockReturnValue([HTTP_STATUS_OK, [], { [X_TOTAL_HEADER]: '0' }]); createComponent(); @@ -300,7 +303,7 @@ describe('Milestone combobox component', () => { beforeEach(() => { projectMilestonesApiCallSpy = jest .fn() - .mockReturnValue([200, [], { [X_TOTAL_HEADER]: '0' }]); + .mockReturnValue([HTTP_STATUS_OK, [], { [X_TOTAL_HEADER]: '0' }]); createComponent(); @@ -314,8 +317,10 @@ describe('Milestone combobox component', () => { describe('when the project milestones search returns an error', () => { beforeEach(() => { - projectMilestonesApiCallSpy = jest.fn().mockReturnValue([500]); - searchApiCallSpy = jest.fn().mockReturnValue([500]); + projectMilestonesApiCallSpy = jest + .fn() + .mockReturnValue([HTTP_STATUS_INTERNAL_SERVER_ERROR]); + searchApiCallSpy = jest.fn().mockReturnValue([HTTP_STATUS_INTERNAL_SERVER_ERROR]); createComponent({ value: [] }); @@ -363,7 +368,7 @@ describe('Milestone combobox component', () => { createComponent(); projectMilestonesApiCallSpy = jest .fn() - .mockReturnValue([200, [{ title: 'v1.0' }], { [X_TOTAL_HEADER]: '1' }]); + .mockReturnValue([HTTP_STATUS_OK, [{ title: 'v1.0' }], { [X_TOTAL_HEADER]: '1' }]); return waitForRequests(); }); @@ -427,7 +432,7 @@ describe('Milestone combobox component', () => { beforeEach(() => { groupMilestonesApiCallSpy = jest .fn() - .mockReturnValue([200, [], { [X_TOTAL_HEADER]: '0' }]); + .mockReturnValue([HTTP_STATUS_OK, [], { [X_TOTAL_HEADER]: '0' }]); createComponent(); @@ -441,8 +446,10 @@ describe('Milestone combobox component', () => { describe('when the group milestones search returns an error', () => { beforeEach(() => { - groupMilestonesApiCallSpy = jest.fn().mockReturnValue([500]); - searchApiCallSpy = jest.fn().mockReturnValue([500]); + groupMilestonesApiCallSpy = jest + .fn() + .mockReturnValue([HTTP_STATUS_INTERNAL_SERVER_ERROR]); + searchApiCallSpy = jest.fn().mockReturnValue([HTTP_STATUS_INTERNAL_SERVER_ERROR]); createComponent({ value: [] }); @@ -490,7 +497,11 @@ describe('Milestone combobox component', () => { createComponent(); groupMilestonesApiCallSpy = jest .fn() - .mockReturnValue([200, [{ title: 'group-v1.0' }], { [X_TOTAL_HEADER]: '1' }]); + .mockReturnValue([ + HTTP_STATUS_OK, + [{ title: 'group-v1.0' }], + { [X_TOTAL_HEADER]: '1' }, + ]); return waitForRequests(); }); |