Skip to content

Commit

Permalink
test: add UT
Browse files Browse the repository at this point in the history
  • Loading branch information
WillieRuemmele committed Oct 2, 2024
1 parent 446586b commit 8c89879
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/utils/coverage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { expect } from 'chai';
import { ApexTestResultOutcome } from '@salesforce/apex-node';
import { StandardColors } from '@salesforce/sf-plugins-core';
import { coverageOutput, getCoveragePct, mapTestResults } from '../../src/utils/coverage.js';
import { coverageOutput, generateCoveredLines, getCoveragePct, mapTestResults } from '../../src/utils/coverage.js';

// methods are mutating the object instead of returning new ones
function getSampleTestResult() {
Expand Down Expand Up @@ -373,6 +373,9 @@ describe('coverage utils', () => {
it('1 uncovered of 4', () => {
expect(getCoveragePct(getSampleTestResult().codeCoverage[0])).equal(75);
});
it('will generate covered lines correctly', () => {
expect(generateCoveredLines(getSampleTestResult().codeCoverage[0])).to.deep.equal([[12], [13, 14, 15]]);
});
it('rounds 3 uncovered out of 44 to the nearest integer', () => {
expect(getCoveragePct(getSampleTestResult().codeCoverage[1])).equal(93);
});
Expand Down

0 comments on commit 8c89879

Please sign in to comment.