diff options
Diffstat (limited to 'packages/sol-cov/test')
-rw-r--r-- | packages/sol-cov/test/collect_coverage_entries_test.ts | 18 | ||||
-rw-r--r-- | packages/sol-cov/test/instructions_test.ts | 1 | ||||
-rw-r--r-- | packages/sol-cov/test/sol_compiler_artifact_adapter_test.ts | 1 | ||||
-rw-r--r-- | packages/sol-cov/test/source_maps_test.ts | 1 | ||||
-rw-r--r-- | packages/sol-cov/test/utils_test.ts | 1 |
5 files changed, 5 insertions, 17 deletions
diff --git a/packages/sol-cov/test/collect_coverage_entries_test.ts b/packages/sol-cov/test/collect_coverage_entries_test.ts index a03be19cd..f88f3b3c3 100644 --- a/packages/sol-cov/test/collect_coverage_entries_test.ts +++ b/packages/sol-cov/test/collect_coverage_entries_test.ts @@ -1,22 +1,14 @@ import * as chai from 'chai'; import * as fs from 'fs'; import * as _ from 'lodash'; -import 'make-promises-safe'; import 'mocha'; import * as path from 'path'; import { collectCoverageEntries } from '../src/collect_coverage_entries'; -import { SingleFileSourceRange } from '../src/types'; +import { utils } from '../src/utils'; const expect = chai.expect; -const getRange = (sourceCode: string, range: SingleFileSourceRange) => { - const lines = sourceCode.split('\n').slice(range.start.line - 1, range.end.line); - lines[lines.length - 1] = lines[lines.length - 1].slice(0, range.end.column); - lines[0] = lines[0].slice(range.start.column); - return lines.join('\n'); -}; - describe('Collect coverage entries', () => { describe('#collectCoverageEntries', () => { it('correctly collects coverage entries for Simplest contract', () => { @@ -45,20 +37,20 @@ describe('Collect coverage entries', () => { const setFunction = `function set(uint x) { storedData = x; }`; - expect(getRange(simpleStorageContract, coverageEntries.fnMap[fnIds[0]].loc)).to.be.equal(setFunction); + expect(utils.getRange(simpleStorageContract, coverageEntries.fnMap[fnIds[0]].loc)).to.be.equal(setFunction); expect(coverageEntries.fnMap[fnIds[1]].name).to.be.equal('get'); // tslint:disable-next-line:custom-no-magic-numbers expect(coverageEntries.fnMap[fnIds[1]].line).to.be.equal(8); const getFunction = `function get() constant returns (uint retVal) { return storedData; }`; - expect(getRange(simpleStorageContract, coverageEntries.fnMap[fnIds[1]].loc)).to.be.equal(getFunction); + expect(utils.getRange(simpleStorageContract, coverageEntries.fnMap[fnIds[1]].loc)).to.be.equal(getFunction); expect(coverageEntries.branchMap).to.be.deep.equal({}); const statementIds = _.keys(coverageEntries.statementMap); - expect(getRange(simpleStorageContract, coverageEntries.statementMap[statementIds[1]])).to.be.equal( + expect(utils.getRange(simpleStorageContract, coverageEntries.statementMap[statementIds[1]])).to.be.equal( 'storedData = x', ); - expect(getRange(simpleStorageContract, coverageEntries.statementMap[statementIds[3]])).to.be.equal( + expect(utils.getRange(simpleStorageContract, coverageEntries.statementMap[statementIds[3]])).to.be.equal( 'return storedData;', ); expect(coverageEntries.modifiersStatementIds).to.be.deep.equal([]); diff --git a/packages/sol-cov/test/instructions_test.ts b/packages/sol-cov/test/instructions_test.ts index 02f30a5ca..058053cf9 100644 --- a/packages/sol-cov/test/instructions_test.ts +++ b/packages/sol-cov/test/instructions_test.ts @@ -1,5 +1,4 @@ import * as chai from 'chai'; -import 'make-promises-safe'; import 'mocha'; import { constants } from '../src/constants'; diff --git a/packages/sol-cov/test/sol_compiler_artifact_adapter_test.ts b/packages/sol-cov/test/sol_compiler_artifact_adapter_test.ts index 0ebad669b..9c58d2cef 100644 --- a/packages/sol-cov/test/sol_compiler_artifact_adapter_test.ts +++ b/packages/sol-cov/test/sol_compiler_artifact_adapter_test.ts @@ -1,6 +1,5 @@ import * as chai from 'chai'; import * as _ from 'lodash'; -import 'make-promises-safe'; import 'mocha'; import * as path from 'path'; diff --git a/packages/sol-cov/test/source_maps_test.ts b/packages/sol-cov/test/source_maps_test.ts index 071f5a057..5820bedd7 100644 --- a/packages/sol-cov/test/source_maps_test.ts +++ b/packages/sol-cov/test/source_maps_test.ts @@ -1,7 +1,6 @@ import * as chai from 'chai'; import * as fs from 'fs'; import * as _ from 'lodash'; -import 'make-promises-safe'; import 'mocha'; import * as path from 'path'; diff --git a/packages/sol-cov/test/utils_test.ts b/packages/sol-cov/test/utils_test.ts index 9a0227773..6fc8fcfe1 100644 --- a/packages/sol-cov/test/utils_test.ts +++ b/packages/sol-cov/test/utils_test.ts @@ -1,6 +1,5 @@ import * as chai from 'chai'; import * as dirtyChai from 'dirty-chai'; -import 'make-promises-safe'; import 'mocha'; import { utils } from '../src/utils'; |