diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-23 21:11:12 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-23 21:11:12 +0300 |
commit | cfc8827f6bf9573b02401b1908728da3aed96698 (patch) | |
tree | 30180d04062db3e56d1cc3772888ff4f15e56c10 /spec/frontend/notes | |
parent | a8b96c3072b3bd4d45e6364931042b350bf7fa2e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/notes')
-rw-r--r-- | spec/frontend/notes/stores/actions_spec.js | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/spec/frontend/notes/stores/actions_spec.js b/spec/frontend/notes/stores/actions_spec.js index e87c4ed1eff..c4c0dc58b0d 100644 --- a/spec/frontend/notes/stores/actions_spec.js +++ b/spec/frontend/notes/stores/actions_spec.js @@ -9,6 +9,7 @@ import { EVENT_ISSUABLE_VUE_APP_CHANGE } from '~/issuable/constants'; import axios from '~/lib/utils/axios_utils'; import { HTTP_STATUS_INTERNAL_SERVER_ERROR, + HTTP_STATUS_OK, HTTP_STATUS_SERVICE_UNAVAILABLE, } from '~/lib/utils/http_status'; import * as notesConstants from '~/notes/constants'; @@ -179,7 +180,7 @@ describe('Actions Notes Store', () => { describe('async methods', () => { beforeEach(() => { - axiosMock.onAny().reply(200, {}); + axiosMock.onAny().reply(HTTP_STATUS_OK, {}); }); describe('closeMergeRequest', () => { @@ -253,7 +254,7 @@ describe('Actions Notes Store', () => { const pollResponse = { notes: [], last_fetched_at: '123456' }; const pollHeaders = { 'poll-interval': `${pollInterval}` }; const successMock = () => - axiosMock.onGet(notesDataMock.notesPath).reply(200, pollResponse, pollHeaders); + axiosMock.onGet(notesDataMock.notesPath).reply(HTTP_STATUS_OK, pollResponse, pollHeaders); const failureMock = () => axiosMock.onGet(notesDataMock.notesPath).reply(HTTP_STATUS_INTERNAL_SERVER_ERROR); const advanceAndRAF = async (time) => { @@ -350,7 +351,7 @@ describe('Actions Notes Store', () => { .onGet(notesDataMock.notesPath) .replyOnce(HTTP_STATUS_INTERNAL_SERVER_ERROR) // cause one error .onGet(notesDataMock.notesPath) - .replyOnce(200, pollResponse, pollHeaders) // then a success + .replyOnce(HTTP_STATUS_OK, pollResponse, pollHeaders) // then a success .onGet(notesDataMock.notesPath) .reply(HTTP_STATUS_INTERNAL_SERVER_ERROR); // and then more errors @@ -403,7 +404,7 @@ describe('Actions Notes Store', () => { const endpoint = `${TEST_HOST}/note`; beforeEach(() => { - axiosMock.onDelete(endpoint).replyOnce(200, {}); + axiosMock.onDelete(endpoint).replyOnce(HTTP_STATUS_OK, {}); document.body.dataset.page = ''; }); @@ -472,7 +473,7 @@ describe('Actions Notes Store', () => { const endpoint = `${TEST_HOST}/note`; beforeEach(() => { - axiosMock.onDelete(endpoint).replyOnce(200, {}); + axiosMock.onDelete(endpoint).replyOnce(HTTP_STATUS_OK, {}); document.body.dataset.page = ''; }); @@ -512,7 +513,7 @@ describe('Actions Notes Store', () => { }; beforeEach(() => { - axiosMock.onAny().reply(200, res); + axiosMock.onAny().reply(HTTP_STATUS_OK, res); }); it('commits ADD_NEW_NOTE and dispatches updateMergeRequestWidget', () => { @@ -547,7 +548,7 @@ describe('Actions Notes Store', () => { }; beforeEach(() => { - axiosMock.onAny().replyOnce(200, res); + axiosMock.onAny().replyOnce(HTTP_STATUS_OK, res); }); it('does not commit ADD_NEW_NOTE or dispatch updateMergeRequestWidget', () => { @@ -568,7 +569,7 @@ describe('Actions Notes Store', () => { }; beforeEach(() => { - axiosMock.onAny().reply(200, res); + axiosMock.onAny().reply(HTTP_STATUS_OK, res); }); describe('as note', () => { @@ -759,7 +760,7 @@ describe('Actions Notes Store', () => { it('updates discussion if response contains disussion', () => { const discussion = { notes: [] }; - axiosMock.onAny().reply(200, { discussion }); + axiosMock.onAny().reply(HTTP_STATUS_OK, { discussion }); return testAction( actions.replyToDiscussion, @@ -778,7 +779,7 @@ describe('Actions Notes Store', () => { it('adds a reply to a discussion', () => { const res = {}; - axiosMock.onAny().reply(200, res); + axiosMock.onAny().reply(HTTP_STATUS_OK, res); return testAction( actions.replyToDiscussion, @@ -1191,7 +1192,7 @@ describe('Actions Notes Store', () => { describe('if response contains no errors', () => { it('dispatches requestDeleteDescriptionVersion', () => { - axiosMock.onDelete(endpoint).replyOnce(200); + axiosMock.onDelete(endpoint).replyOnce(HTTP_STATUS_OK); return testAction( actions.softDeleteDescriptionVersion, payload, @@ -1443,7 +1444,7 @@ describe('Actions Notes Store', () => { }); it('updates the discussions and dispatches `updateResolvableDiscussionsCounts`', () => { - axiosMock.onAny().reply(200, { discussion }); + axiosMock.onAny().reply(HTTP_STATUS_OK, { discussion }); return testAction( actions.fetchDiscussions, {}, @@ -1509,7 +1510,7 @@ describe('Actions Notes Store', () => { const actionPayload = { config, path: 'test-path', perPage: 20 }; it('updates the discussions and dispatches `updateResolvableDiscussionsCounts if there are no headers', () => { - axiosMock.onAny().reply(200, { discussion }, {}); + axiosMock.onAny().reply(HTTP_STATUS_OK, { discussion }, {}); return testAction( actions.fetchDiscussionsBatch, actionPayload, @@ -1524,7 +1525,7 @@ describe('Actions Notes Store', () => { }); it('dispatches itself if there is `x-next-page-cursor` header', () => { - axiosMock.onAny().reply(200, { discussion }, { 'x-next-page-cursor': 1 }); + axiosMock.onAny().reply(HTTP_STATUS_OK, { discussion }, { 'x-next-page-cursor': 1 }); return testAction( actions.fetchDiscussionsBatch, actionPayload, |