|
|
@ -20,17 +20,21 @@ function runTest (testName, testObject, testCallback, resultsCallback) { |
|
|
|
|
|
|
|
|
|
|
|
let passingNum = 0 |
|
|
|
let passingNum = 0 |
|
|
|
let failureNum = 0 |
|
|
|
let failureNum = 0 |
|
|
|
|
|
|
|
let timePassed = 0 |
|
|
|
|
|
|
|
|
|
|
|
testCallback({type: 'contract', value: testName}) |
|
|
|
testCallback({type: 'contract', value: testName}) |
|
|
|
async.eachOfLimit(runList, 1, function (func, index, next) { |
|
|
|
async.eachOfLimit(runList, 1, function (func, index, next) { |
|
|
|
let method = testObject.methods[func.name].apply(testObject.methods[func.name], []) |
|
|
|
let method = testObject.methods[func.name].apply(testObject.methods[func.name], []) |
|
|
|
|
|
|
|
let startTime = Date.now() |
|
|
|
if (func.constant) { |
|
|
|
if (func.constant) { |
|
|
|
method.call().then((result) => { |
|
|
|
method.call().then((result) => { |
|
|
|
|
|
|
|
let time = Math.ceil((Date.now() - startTime) / 1000.0) |
|
|
|
if (result) { |
|
|
|
if (result) { |
|
|
|
testCallback({type: 'testPass', value: changeCase.sentenceCase(func.name)}) |
|
|
|
testCallback({type: 'testPass', value: changeCase.sentenceCase(func.name), time: time}) |
|
|
|
passingNum += 1 |
|
|
|
passingNum += 1 |
|
|
|
|
|
|
|
timePassed += time; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
testCallback({type: 'testFailure', value: changeCase.sentenceCase(func.name)}) |
|
|
|
testCallback({type: 'testFailure', value: changeCase.sentenceCase(func.name), time: time}) |
|
|
|
failureNum += 1 |
|
|
|
failureNum += 1 |
|
|
|
} |
|
|
|
} |
|
|
|
next() |
|
|
|
next() |
|
|
@ -43,7 +47,8 @@ function runTest (testName, testObject, testCallback, resultsCallback) { |
|
|
|
}, function () { |
|
|
|
}, function () { |
|
|
|
resultsCallback(null, { |
|
|
|
resultsCallback(null, { |
|
|
|
passingNum: passingNum, |
|
|
|
passingNum: passingNum, |
|
|
|
failureNum: failureNum |
|
|
|
failureNum: failureNum, |
|
|
|
|
|
|
|
timePassed: timePassed |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|