Last active
May 20, 2020 19:39
-
-
Save PaulRBerg/1cb81eb3fbc4026c04abfabc84ae9c4b to your computer and use it in GitHub Desktop.
Dummy test file used for reproducing a Buidler bug
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 chai from "chai"; | |
import { deployContract, solidity } from "ethereum-waffle"; | |
import { waffle } from "@nomiclabs/buidler"; | |
import CounterArtifact from "../artifacts/Counter.json"; | |
import { Counter } from "../typechain/Counter"; | |
chai.use(solidity); | |
const { expect } = chai; | |
describe("Counter", () => { | |
// 1 | |
const [wallet] = waffle.provider.getWallets(); | |
// 2 | |
let counter: Counter; | |
beforeEach(async () => { | |
counter = (await deployContract(wallet, CounterArtifact)) as Counter; | |
const initialCount = await counter.count(); | |
// 3 | |
expect(initialCount).to.eq(0); | |
expect(counter.address).to.properAddress; | |
}); | |
// 4 | |
it("should count up", async () => { | |
await counter.countUp(); | |
let count = await counter.count(); | |
expect(count).to.eq(1); | |
await counter.countUp(); | |
count = await counter.count(); | |
expect(count).to.eq(2); | |
}); | |
it("should count down", async () => { | |
// 6 | |
await counter.countDown(); | |
const count = await counter.count(); | |
expect(count).to.eq(0); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment