diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /spec/frontend/api_spec.js | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'spec/frontend/api_spec.js')
-rw-r--r-- | spec/frontend/api_spec.js | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/spec/frontend/api_spec.js b/spec/frontend/api_spec.js index 5f162f498c4..1f92010b771 100644 --- a/spec/frontend/api_spec.js +++ b/spec/frontend/api_spec.js @@ -2,7 +2,6 @@ import MockAdapter from 'axios-mock-adapter'; import Api, { DEFAULT_PER_PAGE } from '~/api'; import axios from '~/lib/utils/axios_utils'; import httpStatus from '~/lib/utils/http_status'; -import createFlash from '~/flash'; jest.mock('~/flash'); @@ -608,30 +607,10 @@ describe('Api', () => { }, ]); - return new Promise((resolve) => { - Api.groupProjects(groupId, query, {}, (response) => { - expect(response.length).toBe(1); - expect(response[0].name).toBe('test'); - resolve(); - }); - }); - }); - - it('uses flesh on error by default', async () => { - const groupId = '123456'; - const query = 'dummy query'; - const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/groups/${groupId}/projects.json`; - const flashCallback = (callCount) => { - expect(createFlash).toHaveBeenCalledTimes(callCount); - createFlash.mockClear(); - }; - - mock.onGet(expectedUrl).reply(500, null); - - const response = await Api.groupProjects(groupId, query, {}, () => {}).then(() => { - flashCallback(1); + return Api.groupProjects(groupId, query, {}).then((response) => { + expect(response.data.length).toBe(1); + expect(response.data[0].name).toBe('test'); }); - expect(response).toBeUndefined(); }); it('NOT uses flesh on error with param useCustomErrorHandler', async () => { @@ -640,7 +619,7 @@ describe('Api', () => { const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/groups/${groupId}/projects.json`; mock.onGet(expectedUrl).reply(500, null); - const apiCall = Api.groupProjects(groupId, query, {}, () => {}, true); + const apiCall = Api.groupProjects(groupId, query, {}); await expect(apiCall).rejects.toThrow(); }); }); |