Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 23698
0 votes

How to use truffle-assertions to check if a constructor will revert?

For this example contract, I used: contract("Reverts", (accounts) => { it("Check that param1=false, constructor reverts.", async () =>{ try{ await Reverts.new(false); } … catch{return;} assert.fail("Constructor does not revert when param1=false."); }); }); If the constructor reverts, the test simply returns and shows as passing. …
Expectator's user avatar
0 votes
2 answers
190 views

How to use truffle-assertions to check if a constructor will revert?

Say I have a contract: contract Reverts{ constructor(param1){ require(param1); } } If param1 is false, the constructor should fail and revert state. truffle-assertions allows me to check … How can I achieve this functionality with a constructor, instead of a regular function? …
Expectator's user avatar