diff --git a/libs/remix-tests/src/assertionEvents.ts b/libs/remix-tests/src/assertionEvents.ts new file mode 100644 index 0000000000..2aeedf5499 --- /dev/null +++ b/libs/remix-tests/src/assertionEvents.ts @@ -0,0 +1,12 @@ +const assertionEvents = [ + { + name: 'AssertionEvent', + params: ['bool', 'string'] + }, + { + name: 'AssertionEventUint', + params: ['bool', 'string', 'uint256', 'uint256'] + } +] + +export default assertionEvents \ No newline at end of file diff --git a/libs/remix-tests/src/testRunner.ts b/libs/remix-tests/src/testRunner.ts index 6b2409edca..74fe2c62fd 100644 --- a/libs/remix-tests/src/testRunner.ts +++ b/libs/remix-tests/src/testRunner.ts @@ -1,6 +1,7 @@ import async from 'async' import * as changeCase from 'change-case' import Web3 from 'web3'; +import assertionEvents from './assertionEvents' import { RunListInterface, TestCbInterface, TestResultInterface, ResultCbInterface, CompiledContract, AstNode, Options, FunctionDescription, UserDocumentation } from './types' @@ -228,19 +229,8 @@ export function runTest (testName: string, testObject: any, contractDetails: Com method.send(sendParams).on('receipt', (receipt) => { try { const time: number = (Date.now() - startTime) / 1000.0 - const assertionEvents = [ - { - name: 'AssertionEvent', - params: ['bool', 'string'] - }, - { - name: 'AssertionEventUint', - params: ['bool', 'string', 'uint256', 'uint256'] - } - ] const assertionEventHashes = assertionEvents.map(e => Web3.utils.sha3(e.name + '(' + e.params.join() + ')') ) let testPassed = false - for (const i in receipt.events) { const event = receipt.events[i] const eIndex = assertionEventHashes.indexOf(event.raw.topics[0]) // event name topic will always be at index 0 diff --git a/libs/remix-tests/tests/examples_0/assert_lesserThan_test.sol b/libs/remix-tests/tests/examples_0/assert_lesserThan_test.sol index 7ac7955dd0..cf2afc2bcd 100644 --- a/libs/remix-tests/tests/examples_0/assert_lesserThan_test.sol +++ b/libs/remix-tests/tests/examples_0/assert_lesserThan_test.sol @@ -1,4 +1,3 @@ - import "remix_tests.sol"; // this import is automatically injected by Remix. contract AssertLesserThanTest {