Add more fixes, arrow functions

pull/7/head
Omkara 6 years ago
parent 206a65494e
commit 7fb7747b5a
  1. 8
      remix-tests/src/compiler.ts
  2. 15
      remix-tests/src/index.ts
  3. 4
      remix-tests/src/testRunner.ts
  4. 10
      remix-tests/tests/testRunner.ts

@ -67,7 +67,7 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts:
},
function doCompilation(next: Function) {
// @ts-ignore
compiler.event.register('compilationFinished', this, function (success, data, source) {
compiler.event.register('compilationFinished', this, (success, data, source) => {
next(null, data)
})
compiler.compile(sources, filepath)
@ -83,8 +83,8 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts:
}
}
export function compileContractSources(sources: SrcIfc, importFileCb, opts, cb) {
let compiler, filepath
export function compileContractSources(sources: SrcIfc, importFileCb: any, opts: any, cb: Function) {
let compiler, filepath: string
let accounts = opts.accounts || []
// Iterate over sources keys. Inject test libraries. Inject test library import statements.
if (!('remix_tests.sol' in sources) && !('tests.sol' in sources)) {
@ -110,7 +110,7 @@ export function compileContractSources(sources: SrcIfc, importFileCb, opts, cb)
},
function doCompilation (next: Function) {
// @ts-ignore
compiler.event.register('compilationFinished', this, function (success, data, source) {
compiler.event.register('compilationFinished', this, (success, data, source) => {
next(null, data)
})
compiler.compile(sources, filepath)

@ -1,10 +1,5 @@
import { runTestFiles } from './runTestFiles'
import { runTestSources } from './runTestSources'
import { runTest } from './testRunner'
module.exports = {
runTestFiles: runTestFiles,
runTestSources: runTestSources,
runTest: runTest,
assertLibCode: require('../sol/tests.sol.js')
}
export { runTestFiles } from './runTestFiles'
export { runTestSources } from './runTestSources'
export { runTest } from './testRunner'
export * from './types'
export { assertLibCode } from '../sol/tests.sol.js'

@ -3,7 +3,7 @@ import * as changeCase from 'change-case'
import Web3 from 'web3'
import { RunListInterface, TestCbInterface, TestResultInterface, ResultCbInterface } from './types'
function getFunctionFullName (signature, methodIdentifiers) {
function getFunctionFullName (signature: string, methodIdentifiers) {
for (var method in methodIdentifiers) {
if (signature.replace('0x', '') === methodIdentifiers[method].replace('0x', '')) {
return method
@ -12,7 +12,7 @@ function getFunctionFullName (signature, methodIdentifiers) {
return null
}
function getOverridedSender (userdoc, signature, methodIdentifiers) {
function getOverridedSender (userdoc, signature: string, methodIdentifiers) {
let fullName: any = getFunctionFullName(signature, methodIdentifiers)
let match = /sender: account-+(\d)/g
let accountIndex = userdoc.methods[fullName] ? match.exec(userdoc.methods[fullName].notice) : null

@ -5,8 +5,8 @@ import { Provider } from 'remix-simulator'
import { compileFileOrFiles } from '../dist/compiler'
import { deployAll } from '../dist/deployer'
import { runTest } from '../dist/testRunner'
import { ResultsInterface, TestCbInterface, ResultCbInterface } from '../dist/types'
import { runTest } from '../dist/index'
import { ResultsInterface, TestCbInterface, ResultCbInterface } from '../dist/index'
function compileAndDeploy(filename: string, callback: Function) {
let web3: Web3 = new Web3()
@ -119,7 +119,7 @@ describe('testRunner', () => {
let tests: any[] = [], results: ResultsInterface;
before(function (done) {
compileAndDeploy(filename, function (_err, compilationData, contracts, accounts) {
compileAndDeploy(filename, (_err, compilationData, contracts, accounts) => {
var testCallback: TestCbInterface = (err, test) => {
if (err) { throw err }
tests.push(test)
@ -158,7 +158,7 @@ describe('testRunner', () => {
let tests: any[] = [], results: ResultsInterface;
before(function (done) {
compileAndDeploy(filename, function (_err, compilationData, contracts, accounts) {
compileAndDeploy(filename, (_err, compilationData, contracts, accounts) => {
var testCallback: TestCbInterface = (err, test) => {
if (err) { throw err }
tests.push(test)
@ -186,7 +186,7 @@ describe('testRunner', () => {
let tests: any[] = [], results: ResultsInterface;
before(function (done) {
compileAndDeploy(filename, function (_err, compilationData, contracts, accounts) {
compileAndDeploy(filename, (_err, compilationData, contracts, accounts) => {
var testCallback: TestCbInterface = (err, test) => {
if (err) { throw err }
tests.push(test)

Loading…
Cancel
Save