Skip to content

Commit

Permalink
Refactoring ts-tests (#272)
Browse files Browse the repository at this point in the history
* truffle init

* import contract bytecode from build

* modify test contract importing

* import ExplicitRevertReason contract

* remove unnecessary description and modify according to rule

* fix import error

* modify contract creation transaction hash
  • Loading branch information
ashWhiteHat authored Jan 18, 2021
1 parent fb76cd0 commit 663dca7
Show file tree
Hide file tree
Showing 18 changed files with 452 additions and 83 deletions.
3 changes: 2 additions & 1 deletion ts-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
frontier-test-tmp
frontier-test-tmp
build/
9 changes: 9 additions & 0 deletions ts-tests/contracts/ExplicitRevertReason.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pragma solidity 0.5.16;

contract ExplicitRevertReason {
function max10(uint256 a) public returns (uint256) {
if (a > 10)
revert("Value must not be greater than 10.");
return a;
}
}
7 changes: 7 additions & 0 deletions ts-tests/contracts/Test.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pragma solidity 0.5.16;

contract Test {
function multiply(uint a) public pure returns(uint d) {
return a * 7;
}
}
290 changes: 290 additions & 0 deletions ts-tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion ts-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "mocha -r ts-node/register 'tests/**/*.ts'"
"build": "truffle compile",
"test": "truffle compile && mocha -r ts-node/register 'tests/**/*.ts'"
},
"author": "",
"license": "ISC",
Expand All @@ -15,6 +16,7 @@
"mocha": "^8.0.1",
"mocha-steps": "^1.3.0",
"rimraf": "^3.0.2",
"truffle": "^5.1.62",
"ts-node": "^8.10.2",
"typescript": "^3.9.6",
"web3": "^1.2.9"
Expand Down
2 changes: 1 addition & 1 deletion ts-tests/tests/test-balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describeWithFrontier("Frontier RPC (Balance)", `simple-specs.json`, (context) =>

step("balance to be updated after transfer", async function () {
this.timeout(15000);

const tx = await context.web3.eth.accounts.signTransaction({
from: GENESIS_ACCOUNT,
to: TEST_ACCOUNT,
Expand Down
Loading

0 comments on commit 663dca7

Please sign in to comment.