Created
August 13, 2020 19:09
-
-
Save PaulRBerg/9e3253c22940bed179681dbc7d8313c2 to your computer and use it in GitHub Desktop.
Logging block timestamps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { BigNumber } from "@ethersproject/bignumber"; | |
import { Signer } from "@ethersproject/abstract-signer"; | |
import { waffle } from "@nomiclabs/buidler"; | |
import { expect } from "chai"; | |
export function shouldBehaveLikeGreeter(_signers: Signer[]): void { | |
describe("1st Block", function () { | |
beforeEach(async function () { | |
await waffle.provider.send("evm_setNextBlockTimestamp", [1597348800]); | |
const blockTimestamp: BigNumber = await this.testotron.getBlockTimestamp(); | |
console.log({ "1stTimestamp": blockTimestamp.toString() }); | |
}); | |
it("should pass the 1st test", async function () { | |
expect(await this.greeter.greet()).to.equal("Hello, world!"); | |
await this.greeter.setGreeting("Hola, mundo!"); | |
expect(await this.greeter.greet()).to.equal("Hola, mundo!"); | |
}); | |
}); | |
describe("2nd Block", function () { | |
it("pass the 2nd test", async function () { | |
expect(await this.greeter.greet()).to.equal("Hello, world!"); | |
await this.greeter.setGreeting("Hola, mundo!"); | |
expect(await this.greeter.greet()).to.equal("Hola, mundo!"); | |
}); | |
beforeEach(async function () { | |
const blockTimestamp: BigNumber = await this.testotron.getBlockTimestamp(); | |
console.log({ "2ndTimestamp": blockTimestamp.toString() }); | |
}); | |
}); | |
describe("3rd Block", function () { | |
it("pass the 2nd test", async function () { | |
expect(await this.greeter.greet()).to.equal("Hello, world!"); | |
await this.greeter.setGreeting("Hola, mundo!"); | |
expect(await this.greeter.greet()).to.equal("Hola, mundo!"); | |
}); | |
beforeEach(async function () { | |
const blockTimestamp: BigNumber = await this.testotron.getBlockTimestamp(); | |
console.log({ "3rdTimestamp": blockTimestamp.toString() }); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment