|
|
@ -286,13 +286,15 @@ export function runTest (testName: string, testObject: any, contractDetails: Com |
|
|
|
const assertionEventHashes = assertionEvents.map(e => Web3.utils.sha3(e.name + '(' + e.params.join() + ')') ) |
|
|
|
const assertionEventHashes = assertionEvents.map(e => Web3.utils.sha3(e.name + '(' + e.params.join() + ')') ) |
|
|
|
let testPassed = false |
|
|
|
let testPassed = false |
|
|
|
for (const i in receipt.events) { |
|
|
|
for (const i in receipt.events) { |
|
|
|
const event = receipt.events[i] |
|
|
|
let events = receipt.events[i] |
|
|
|
|
|
|
|
if (!Array.isArray(events)) events = [events] |
|
|
|
|
|
|
|
for (const event of events) { |
|
|
|
const eIndex = assertionEventHashes.indexOf(event.raw.topics[0]) // event name topic will always be at index 0
|
|
|
|
const eIndex = assertionEventHashes.indexOf(event.raw.topics[0]) // event name topic will always be at index 0
|
|
|
|
if (eIndex >= 0) { |
|
|
|
if (eIndex >= 0) { |
|
|
|
const testEvent = web3.eth.abi.decodeParameters(assertionEvents[eIndex].params, event.raw.data) |
|
|
|
const testEvent = web3.eth.abi.decodeParameters(assertionEvents[eIndex].params, event.raw.data) |
|
|
|
if (!testEvent[0]) { |
|
|
|
if (!testEvent[0]) { |
|
|
|
const assertMethod = testEvent[2] |
|
|
|
const assertMethod = testEvent[2] |
|
|
|
if(assertMethod === 'ok') { // for 'Assert.ok' method
|
|
|
|
if (assertMethod === 'ok') { // for 'Assert.ok' method
|
|
|
|
testEvent[3] = 'false' |
|
|
|
testEvent[3] = 'false' |
|
|
|
testEvent[4] = 'true' |
|
|
|
testEvent[4] = 'true' |
|
|
|
} |
|
|
|
} |
|
|
@ -317,6 +319,7 @@ export function runTest (testName: string, testObject: any, contractDetails: Com |
|
|
|
testPassed = true |
|
|
|
testPassed = true |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (testPassed) { |
|
|
|
if (testPassed) { |
|
|
|
const resp: TestResultInterface = { |
|
|
|
const resp: TestResultInterface = { |
|
|
|