How to simulate a date in the future with truffle tests?

My tests calls start failing whenever I use evm_increaseTime found this deleted question using google chache, since the question was accidentally deleted.

My situation is quite similar, and it would be awesome if @itinance could elaborate on his solution.

2 Likes

Hi @ccolorado

there is already a library for that :slight_smile: thanks to OpenZepplin.

Have a look at my tests: https://github.com/itinance/ncd-token/blob/master/test/NCDTokenSaleTeamTokens.js#L66, there are plenty examples.

While it is possible to increase to a specific timestamp, I recommend to not use fixed dates because ganache-cli can never roll back. So I constantely increase the time by some delta values into the future.

3 Likes

Welcome to the community @ccolorado

OpenZeppelin Test Helpers are awesome, the README has lots of information on how to use. If you have any questions please ask. :smile:

OpenZeppelin tests are great examples of using the Test Helpers. For time have a look at TimedCrowdsale.test.js

I undeleted @itinance original topic, so for future people they can find it. Well done on finding the community through that.

1 Like

A post was split to a new topic: Simulate a date in the future