Skip to content

Instantly share code, notes, and snippets.

@PaulRBerg
Last active May 20, 2020 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PaulRBerg/1cb81eb3fbc4026c04abfabc84ae9c4b to your computer and use it in GitHub Desktop.
Save PaulRBerg/1cb81eb3fbc4026c04abfabc84ae9c4b to your computer and use it in GitHub Desktop.
Dummy test file used for reproducing a Buidler bug
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