magmo/rps-poc

assertRevert does not throw an assertion error on true

Opened this issue · 0 comments

Making the following modification to /test/rock-paper-scissors.js:

  it("disallows transitions where the stake changes", async () => {
    reveal.roundBuyIn = bnToHex(hexToBN(reveal.roundBuyIn).add(new BN(1)));
    // assertRevert(validTransition(reveal, resting));
    assertRevert(true);
  });

I would expect the test not to be passed. The fact that it doe pass, indicates that assertRevert is not trustworthy, since if we made a mistake in coding validTransition, such that it failed to revert on a disallowed move, our tests for this scenario would still pass.

fmg-core has an improved helper called expectRevert.

So this could be an easy fix!