diff options
Diffstat (limited to 'spec/frontend/pipelines/test_reports')
3 files changed, 49 insertions, 11 deletions
diff --git a/spec/frontend/pipelines/test_reports/stores/mutations_spec.js b/spec/frontend/pipelines/test_reports/stores/mutations_spec.js index 9eaa563025d..a0eb93c4e6b 100644 --- a/spec/frontend/pipelines/test_reports/stores/mutations_spec.js +++ b/spec/frontend/pipelines/test_reports/stores/mutations_spec.js @@ -20,7 +20,7 @@ describe('Mutations TestReports Store', () => { describe('set endpoint', () => { it('should set endpoint', () => { - const expectedState = Object.assign({}, mockState, { endpoint: 'foo' }); + const expectedState = { ...mockState, endpoint: 'foo' }; mutations[types.SET_ENDPOINT](mockState, 'foo'); expect(mockState.endpoint).toEqual(expectedState.endpoint); @@ -47,14 +47,14 @@ describe('Mutations TestReports Store', () => { describe('toggle loading', () => { it('should set to true', () => { - const expectedState = Object.assign({}, mockState, { isLoading: true }); + const expectedState = { ...mockState, isLoading: true }; mutations[types.TOGGLE_LOADING](mockState); expect(mockState.isLoading).toEqual(expectedState.isLoading); }); it('should toggle back to false', () => { - const expectedState = Object.assign({}, mockState, { isLoading: false }); + const expectedState = { ...mockState, isLoading: false }; mockState.isLoading = true; mutations[types.TOGGLE_LOADING](mockState); diff --git a/spec/frontend/pipelines/test_reports/test_summary_spec.js b/spec/frontend/pipelines/test_reports/test_summary_spec.js index 160d93d2e6b..8f041e46472 100644 --- a/spec/frontend/pipelines/test_reports/test_summary_spec.js +++ b/spec/frontend/pipelines/test_reports/test_summary_spec.js @@ -82,17 +82,19 @@ describe('Test reports summary', () => { describe('success percentage calculation', () => { it.each` - name | successCount | totalCount | result - ${'displays 0 when there are no tests'} | ${0} | ${0} | ${'0'} - ${'displays whole number when possible'} | ${10} | ${50} | ${'20'} - ${'rounds to 0.01'} | ${1} | ${16604} | ${'0.01'} - ${'correctly rounds to 50'} | ${8302} | ${16604} | ${'50'} - ${'rounds down for large close numbers'} | ${16603} | ${16604} | ${'99.99'} - ${'correctly displays 100'} | ${16604} | ${16604} | ${'100'} - `('$name', ({ successCount, totalCount, result }) => { + name | successCount | totalCount | skippedCount | result + ${'displays 0 when there are no tests'} | ${0} | ${0} | ${0} | ${'0'} + ${'displays whole number when possible'} | ${10} | ${50} | ${0} | ${'20'} + ${'excludes skipped tests from total'} | ${10} | ${50} | ${5} | ${'22.22'} + ${'rounds to 0.01'} | ${1} | ${16604} | ${0} | ${'0.01'} + ${'correctly rounds to 50'} | ${8302} | ${16604} | ${0} | ${'50'} + ${'rounds down for large close numbers'} | ${16603} | ${16604} | ${0} | ${'99.99'} + ${'correctly displays 100'} | ${16604} | ${16604} | ${0} | ${'100'} + `('$name', ({ successCount, totalCount, skippedCount, result }) => { createComponent({ report: { success_count: successCount, + skipped_count: skippedCount, total_count: totalCount, }, }); diff --git a/spec/frontend/pipelines/test_reports/test_summary_table_spec.js b/spec/frontend/pipelines/test_reports/test_summary_table_spec.js index 9146f301f66..b585536ae09 100644 --- a/spec/frontend/pipelines/test_reports/test_summary_table_spec.js +++ b/spec/frontend/pipelines/test_reports/test_summary_table_spec.js @@ -37,11 +37,47 @@ describe('Test reports summary table', () => { describe('when test reports are supplied', () => { beforeEach(() => createComponent()); + const findErrorIcon = () => wrapper.find({ ref: 'suiteErrorIcon' }); it('renders the correct number of rows', () => { expect(noSuitesToShow().exists()).toBe(false); expect(allSuitesRows().length).toBe(testReports.test_suites.length); }); + + describe('when there is a suite error', () => { + beforeEach(() => { + createComponent({ + test_suites: [ + { + ...testReports.test_suites[0], + suite_error: 'Suite Error', + }, + ], + }); + }); + + it('renders error icon', () => { + expect(findErrorIcon().exists()).toBe(true); + expect(findErrorIcon().attributes('title')).toEqual('Suite Error'); + }); + }); + + describe('when there is not a suite error', () => { + beforeEach(() => { + createComponent({ + test_suites: [ + { + ...testReports.test_suites[0], + suite_error: null, + }, + ], + }); + }); + + it('does not render error icon', () => { + expect(findErrorIcon().exists()).toBe(false); + }); + }); }); describe('when there are no test suites', () => { |