|
|
@ -59,37 +59,27 @@ function runTest (testName, testObject, testCallback, resultsCallback) { |
|
|
|
method.send().on('receipt', function (receipt) { |
|
|
|
method.send().on('receipt', function (receipt) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
let time = Math.ceil((Date.now() - startTime) / 1000.0) |
|
|
|
let time = Math.ceil((Date.now() - startTime) / 1000.0) |
|
|
|
// if (func.type === 'test') {
|
|
|
|
|
|
|
|
let topic = Web3.utils.sha3('AssertionEvent(bool,string)') |
|
|
|
let topic = Web3.utils.sha3('AssertionEvent(bool,string)') |
|
|
|
|
|
|
|
|
|
|
|
let matchingEvents = [] |
|
|
|
|
|
|
|
for (let i in receipt.events) { |
|
|
|
for (let i in receipt.events) { |
|
|
|
let event = receipt.events[i] |
|
|
|
let event = receipt.events[i] |
|
|
|
if (event.raw.topics.indexOf(topic) >= 0) { |
|
|
|
if (event.raw.topics.indexOf(topic) >= 0) { |
|
|
|
matchingEvents.push(web3.eth.abi.decodeParameters(['bool', 'string'], event.raw.data)) |
|
|
|
var testEvent = web3.eth.abi.decodeParameters(['bool', 'string'], event.raw.data) |
|
|
|
} |
|
|
|
if (testEvent[0]) { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (matchingEvents.length === 0) { |
|
|
|
|
|
|
|
return next() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let result = matchingEvents[0] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (result[0]) { |
|
|
|
|
|
|
|
testCallback({type: 'testPass', value: changeCase.sentenceCase(func.name), time: time, context: testName}) |
|
|
|
testCallback({type: 'testPass', value: changeCase.sentenceCase(func.name), time: time, context: testName}) |
|
|
|
passingNum += 1 |
|
|
|
passingNum += 1 |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
testCallback({type: 'testFailure', value: changeCase.sentenceCase(func.name), time: time, errMsg: result[1], context: testName}) |
|
|
|
testCallback({type: 'testFailure', value: changeCase.sentenceCase(func.name), time: time, errMsg: testEvent[1], context: testName}) |
|
|
|
failureNum += 1 |
|
|
|
failureNum += 1 |
|
|
|
} |
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return next() |
|
|
|
} catch (err) { |
|
|
|
} catch (err) { |
|
|
|
console.log('error!') |
|
|
|
console.log('error!') |
|
|
|
console.dir(err) |
|
|
|
console.dir(err) |
|
|
|
return next(err) |
|
|
|
return next(err) |
|
|
|
} |
|
|
|
} |
|
|
|
next() |
|
|
|
|
|
|
|
}).on('error', function (err) { |
|
|
|
}).on('error', function (err) { |
|
|
|
next(err) |
|
|
|
next(err) |
|
|
|
}) |
|
|
|
}) |
|
|
|