diff options
Diffstat (limited to 'spec/frontend/reports/codequality_report')
3 files changed, 21 insertions, 28 deletions
diff --git a/spec/frontend/reports/codequality_report/components/codequality_issue_body_spec.js b/spec/frontend/reports/codequality_report/components/codequality_issue_body_spec.js index c548007a8a6..17f07ac2b8f 100644 --- a/spec/frontend/reports/codequality_report/components/codequality_issue_body_spec.js +++ b/spec/frontend/reports/codequality_report/components/codequality_issue_body_spec.js @@ -51,6 +51,7 @@ describe('code quality issue body issue body', () => { ${'blocker'} | ${'text-danger-800'} | ${'severity-critical'} ${'unknown'} | ${'text-secondary-400'} | ${'severity-unknown'} ${'invalid'} | ${'text-secondary-400'} | ${'severity-unknown'} + ${undefined} | ${'text-secondary-400'} | ${'severity-unknown'} `( 'renders correct icon for "$severity" severity rating', ({ severity, iconClass, iconName }) => { diff --git a/spec/frontend/reports/codequality_report/grouped_codequality_reports_app_spec.js b/spec/frontend/reports/codequality_report/grouped_codequality_reports_app_spec.js index 1f923f41274..b61b65c2713 100644 --- a/spec/frontend/reports/codequality_report/grouped_codequality_reports_app_spec.js +++ b/spec/frontend/reports/codequality_report/grouped_codequality_reports_app_spec.js @@ -135,7 +135,7 @@ describe('Grouped code quality reports app', () => { }); it('does not render a help icon', () => { - expect(findWidget().find('[data-testid="question-icon"]').exists()).toBe(false); + expect(findWidget().find('[data-testid="question-o-icon"]').exists()).toBe(false); }); describe('when base report was not found', () => { @@ -144,7 +144,7 @@ describe('Grouped code quality reports app', () => { }); it('renders a help icon with more information', () => { - expect(findWidget().find('[data-testid="question-icon"]').exists()).toBe(true); + expect(findWidget().find('[data-testid="question-o-icon"]').exists()).toBe(true); }); }); }); diff --git a/spec/frontend/reports/codequality_report/store/actions_spec.js b/spec/frontend/reports/codequality_report/store/actions_spec.js index 1821390786b..71f1a0f4de0 100644 --- a/spec/frontend/reports/codequality_report/store/actions_spec.js +++ b/spec/frontend/reports/codequality_report/store/actions_spec.js @@ -23,7 +23,7 @@ describe('Codequality Reports actions', () => { }); describe('setPaths', () => { - it('should commit SET_PATHS mutation', (done) => { + it('should commit SET_PATHS mutation', () => { const paths = { baseBlobPath: 'baseBlobPath', headBlobPath: 'headBlobPath', @@ -31,13 +31,12 @@ describe('Codequality Reports actions', () => { helpPath: 'codequalityHelpPath', }; - testAction( + return testAction( actions.setPaths, paths, localState, [{ type: types.SET_PATHS, payload: paths }], [], - done, ); }); }); @@ -56,10 +55,10 @@ describe('Codequality Reports actions', () => { }); describe('on success', () => { - it('commits REQUEST_REPORTS and dispatches receiveReportsSuccess', (done) => { + it('commits REQUEST_REPORTS and dispatches receiveReportsSuccess', () => { mock.onGet(endpoint).reply(200, reportIssues); - testAction( + return testAction( actions.fetchReports, null, localState, @@ -70,51 +69,48 @@ describe('Codequality Reports actions', () => { type: 'receiveReportsSuccess', }, ], - done, ); }); }); describe('on error', () => { - it('commits REQUEST_REPORTS and dispatches receiveReportsError', (done) => { + it('commits REQUEST_REPORTS and dispatches receiveReportsError', () => { mock.onGet(endpoint).reply(500); - testAction( + return testAction( actions.fetchReports, null, localState, [{ type: types.REQUEST_REPORTS }], [{ type: 'receiveReportsError', payload: expect.any(Error) }], - done, ); }); }); describe('when base report is not found', () => { - it('commits REQUEST_REPORTS and dispatches receiveReportsError', (done) => { + it('commits REQUEST_REPORTS and dispatches receiveReportsError', () => { const data = { status: STATUS_NOT_FOUND }; mock.onGet(`${TEST_HOST}/codequality_reports.json`).reply(200, data); - testAction( + return testAction( actions.fetchReports, null, localState, [{ type: types.REQUEST_REPORTS }], [{ type: 'receiveReportsError', payload: data }], - done, ); }); }); describe('while waiting for report results', () => { - it('continues polling until it receives data', (done) => { + it('continues polling until it receives data', () => { mock .onGet(endpoint) .replyOnce(204, undefined, pollIntervalHeader) .onGet(endpoint) .reply(200, reportIssues); - Promise.all([ + return Promise.all([ testAction( actions.fetchReports, null, @@ -126,7 +122,6 @@ describe('Codequality Reports actions', () => { type: 'receiveReportsSuccess', }, ], - done, ), axios // wait for initial NO_CONTENT response to be fulfilled @@ -134,24 +129,23 @@ describe('Codequality Reports actions', () => { .then(() => { jest.advanceTimersByTime(pollInterval); }), - ]).catch(done.fail); + ]); }); - it('continues polling until it receives an error', (done) => { + it('continues polling until it receives an error', () => { mock .onGet(endpoint) .replyOnce(204, undefined, pollIntervalHeader) .onGet(endpoint) .reply(500); - Promise.all([ + return Promise.all([ testAction( actions.fetchReports, null, localState, [{ type: types.REQUEST_REPORTS }], [{ type: 'receiveReportsError', payload: expect.any(Error) }], - done, ), axios // wait for initial NO_CONTENT response to be fulfilled @@ -159,35 +153,33 @@ describe('Codequality Reports actions', () => { .then(() => { jest.advanceTimersByTime(pollInterval); }), - ]).catch(done.fail); + ]); }); }); }); describe('receiveReportsSuccess', () => { - it('commits RECEIVE_REPORTS_SUCCESS', (done) => { + it('commits RECEIVE_REPORTS_SUCCESS', () => { const data = { issues: [] }; - testAction( + return testAction( actions.receiveReportsSuccess, data, localState, [{ type: types.RECEIVE_REPORTS_SUCCESS, payload: data }], [], - done, ); }); }); describe('receiveReportsError', () => { - it('commits RECEIVE_REPORTS_ERROR', (done) => { - testAction( + it('commits RECEIVE_REPORTS_ERROR', () => { + return testAction( actions.receiveReportsError, null, localState, [{ type: types.RECEIVE_REPORTS_ERROR, payload: null }], [], - done, ); }); }); |