Skip to content

Commit

Permalink
Updated the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cedx committed May 3, 2019
1 parent abdce4d commit 136a3ef
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 49 deletions.
7 changes: 7 additions & 0 deletions etc/mocha.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"check-leaks": true,
"recursive": true,
"reporter": "spec",
"require": "esm",
"ui": "bdd"
}
5 changes: 0 additions & 5 deletions etc/mocha.yaml

This file was deleted.

6 changes: 6 additions & 0 deletions etc/nyc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"all": true,
"include": ["lib/**/*.js"],
"report-dir": "var",
"reporter": ["lcovonly"]
}
4 changes: 0 additions & 4 deletions etc/nyc.yaml

This file was deleted.

12 changes: 2 additions & 10 deletions test/branch_test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import {expect} from 'chai';
import {BranchCoverage, BranchData} from '../lib/index.js';

/** @test {BranchCoverage} */
/** Tests the features of the `BranchCoverage` class. */
describe('BranchCoverage', () => {

/** @test {BranchCoverage.fromJson} */
describe('.fromJson()', () => {
it('should return an instance with default values for an empty map', () => {
const coverage = BranchCoverage.fromJson({});
Expand All @@ -31,7 +29,6 @@ describe('BranchCoverage', () => {
});
});

/** @test {BranchCoverage#toJSON} */
describe('#toJSON()', () => {
it('should return a map with default values for a newly created instance', () => {
const map = (new BranchCoverage).toJSON();
Expand All @@ -53,7 +50,6 @@ describe('BranchCoverage', () => {
});
});

/** @test {BranchCoverage#toString} */
describe('#toString()', () => {
it('should return a format like "BRF:<found>\\\\n,BRH:<hit>"', () => {
expect(String(new BranchCoverage)).to.equal('BRF:0\nBRH:0');
Expand All @@ -64,10 +60,8 @@ describe('BranchCoverage', () => {
});
});

/** @test {BranchData} */
/** Tests the features of the `BranchData` class. */
describe('BranchData', () => {

/** @test {BranchData.fromJson} */
describe('.fromJson()', () => {
it('should return an instance with default values for an empty map', () => {
const data = BranchData.fromJson({});
Expand All @@ -94,7 +88,6 @@ describe('BranchData', () => {
});
});

/** @test {BranchData#toJSON} */
describe('#toJSON()', () => {
it('should return a map with default values for a newly created instance', () => {
const map = new BranchData(0, 0, 0).toJSON();
Expand All @@ -115,7 +108,6 @@ describe('BranchData', () => {
});
});

/** @test {BranchData#toString} */
describe('#toString()', () => {
it('should return a format like "BRDA:<lineNumber>,<blockNumber>,<branchNumber>,<taken>"', () => {
expect(String(new BranchData(0, 0, 0))).to.equal('BRDA:0,0,0,-');
Expand Down
12 changes: 2 additions & 10 deletions test/function_test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import {expect} from 'chai';
import {FunctionCoverage, FunctionData} from '../lib/index.js';

/** @test {FunctionCoverage} */
/** Tests the features of the `FunctionCoverage` class. */
describe('FunctionCoverage', () => {

/** @test {FunctionCoverage.fromJson} */
describe('.fromJson()', () => {
it('should return an instance with default values for an empty map', () => {
const coverage = FunctionCoverage.fromJson({});
Expand All @@ -31,7 +29,6 @@ describe('FunctionCoverage', () => {
});
});

/** @test {FunctionCoverage#toJSON} */
describe('#toJSON()', () => {
it('should return a map with default values for a newly created instance', () => {
const map = (new FunctionCoverage).toJSON();
Expand All @@ -55,7 +52,6 @@ describe('FunctionCoverage', () => {
});
});

/** @test {FunctionCoverage#toString} */
describe('#toString()', () => {
it('should return a format like "FNF:<found>\\\\n,FNH:<hit>"', () => {
expect(String(new FunctionCoverage)).to.equal('FNF:0\nFNH:0');
Expand All @@ -66,10 +62,8 @@ describe('FunctionCoverage', () => {
});
});

/** @test {FunctionData} */
/** Tests the features of the `FunctionData` class. */
describe('FunctionData', () => {

/** @test {FunctionData.fromJson} */
describe('.fromJson()', () => {
it('should return an instance with default values for an empty map', () => {
const data = FunctionData.fromJson({});
Expand All @@ -93,7 +87,6 @@ describe('FunctionData', () => {
});
});

/** @test {FunctionData#toJSON} */
describe('#toJSON()', () => {
it('should return a map with default values for a newly created instance', () => {
const map = new FunctionData('', 0).toJSON();
Expand All @@ -112,7 +105,6 @@ describe('FunctionData', () => {
});
});

/** @test {FunctionData#toString} */
describe('#toString()', () => {
it('should return a format like "FN:<lineNumber>,<functionName>" when used as definition', () => {
expect(new FunctionData('', 0).toString(true)).to.equal('FN:0,');
Expand Down
12 changes: 2 additions & 10 deletions test/line_test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import {expect} from 'chai';
import {LineCoverage, LineData} from '../lib/index.js';

/** @test {LineCoverage} */
/** Tests the features of the `LineCoverage` class. */
describe('LineCoverage', () => {

/** @test {LineCoverage.fromJson} */
describe('.fromJson()', () => {
it('should return an instance with default values for an empty map', () => {
const coverage = LineCoverage.fromJson({});
Expand All @@ -31,7 +29,6 @@ describe('LineCoverage', () => {
});
});

/** @test {LineCoverage#toJSON} */
describe('#toJSON()', () => {
it('should return a map with default values for a newly created instance', () => {
const map = (new LineCoverage).toJSON();
Expand All @@ -53,7 +50,6 @@ describe('LineCoverage', () => {
});
});

/** @test {LineCoverage#toString} */
describe('#toString()', () => {
it('should return a format like "LF:<found>\\\\n,LH:<hit>"', () => {
expect(String(new LineCoverage)).to.equal('LF:0\nLH:0');
Expand All @@ -64,10 +60,8 @@ describe('LineCoverage', () => {
});
});

/** @test {LineData} */
/** Tests the features of the `LineData` class. */
describe('LineData', () => {

/** @test {LineData.fromJson} */
describe('.fromJson()', () => {
it('should return an instance with default values for an empty map', () => {
const data = LineData.fromJson({});
Expand All @@ -91,7 +85,6 @@ describe('LineData', () => {
});
});

/** @test {LineData#toJSON} */
describe('#toJSON()', () => {
it('should return a map with default values for a newly created instance', () => {
const map = new LineData(0).toJSON();
Expand All @@ -110,7 +103,6 @@ describe('LineData', () => {
});
});

/** @test {LineData#toString} */
describe('#toString()', () => {
it('should return a format like "DA:<lineNumber>,<executionCount>[,<checksum>]"', () => {
expect(String(new LineData(0))).to.equal('DA:0,0');
Expand Down
6 changes: 1 addition & 5 deletions test/record_test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import {expect} from 'chai';
import {BranchCoverage, FunctionCoverage, LineCoverage, Record} from '../lib/index.js';

/** @test {Record} */
/** Tests the features of the `Record` class. */
describe('Record', () => {

/** @test {Record.fromJson} */
describe('.fromJson()', () => {
it('should return an instance with default values for an empty map', () => {
const record = Record.fromJson({});
Expand All @@ -31,7 +29,6 @@ describe('Record', () => {
});
});

/** @test {Record#toJSON} */
describe('#toJSON()', () => {
it('should return a map with default values for a newly created instance', () => {
const map = new Record('').toJSON();
Expand All @@ -58,7 +55,6 @@ describe('Record', () => {
});
});

/** @test {Record#toString} */
describe('#toString()', () => {
it('should return a format like "SF:<sourceFile>\\\\n,end_of_record"', () => {
expect(String(new Record(''))).to.equal('SF:\nend_of_record');
Expand Down
6 changes: 1 addition & 5 deletions test/report_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {expect} from 'chai';
import {BranchData, FunctionData, LcovError, LineData, Record, Report} from '../lib/index.js';

/** @test {Report} */
/** Tests the features of the `Report` class. */
describe('Report', () => {

// A sample coverage report.
Expand Down Expand Up @@ -70,7 +70,6 @@ LH:7
end_of_record
`;

/** @test {Report.fromCoverage} */
describe('.fromCoverage()', () => {
const report = Report.fromCoverage(coverage);

Expand Down Expand Up @@ -125,7 +124,6 @@ end_of_record
});
});

/** @test {Report.fromJson} */
describe('.fromJson()', () => {
it('should return an instance with default values for an empty map', () => {
const report = Report.fromJson({});
Expand All @@ -147,7 +145,6 @@ end_of_record
});
});

/** @test {Report#toJSON} */
describe('#toJSON()', () => {
it('should return a map with default values for a newly created instance', () => {
const map = (new Report).toJSON();
Expand All @@ -165,7 +162,6 @@ end_of_record
});
});

/** @test {Report#toString} */
describe('#toString()', () => {
it('should return a format like "TN:<testName>"', () => {
expect(String(new Report)).to.be.empty;
Expand Down

0 comments on commit 136a3ef

Please sign in to comment.