I'm litte confused how to use expectRevert from openzeppelin-test-helpers properly.
Given is my Contract and the following revert:
require(openingTime >= block.timestamp, "opening time is in the past");
Then I have a test with the following code:
it('reverts if the opening time is in the past', async function () {
await expectRevert(TokenSale.new(
(await time.latest()).sub(time.duration.days(1)), closingTime, token.address
), 'opening time is in the past');
});
which is doing the revert due to its arguments in the function call.
But I still get the following error:
Error: Returned error: VM Exception while processing transaction: revert opening time is in the past -- Reason given: opening time is in the past.
Lets pay attention on the reason string:
revert opening time is in the past
Reason given: opening time is in the past.
The final dot was added somewhere inside expectRevert. It is not part of the reason string wether in the Contract nor in the test.
How can I bring this to work?
