diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-04 21:08:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-04 21:08:46 +0300 |
commit | b41cd8cb92d53454b2b160ba922d33801933a9cf (patch) | |
tree | 3519da8856f8bf12ce9e75248e5ecb9ed4eacf14 /spec/frontend/pipelines/test_reports | |
parent | 8d3aee3636da5181ae94d23b47c6794b5610ab01 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/pipelines/test_reports')
-rw-r--r-- | spec/frontend/pipelines/test_reports/test_summary_spec.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/frontend/pipelines/test_reports/test_summary_spec.js b/spec/frontend/pipelines/test_reports/test_summary_spec.js index 864c7b6f4de..2c1a30f0fd5 100644 --- a/spec/frontend/pipelines/test_reports/test_summary_spec.js +++ b/spec/frontend/pipelines/test_reports/test_summary_spec.js @@ -79,4 +79,25 @@ describe('Test reports summary', () => { expect(duration().text()).toBe('00:00:00'); }); }); + + 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 }) => { + createComponent({ + report: { + success_count: successCount, + total_count: totalCount, + }, + }); + + expect(successRate().text()).toBe(`${result}% success rate`); + }); + }); }); |