Greeter.ts 942 B

123456789101112131415161718192021222324252627282930
  1. import { Signer } from "@ethersproject/abstract-signer";
  2. import { ethers, waffle } from "hardhat";
  3. import GreeterArtifact from "../artifacts/contracts/Greeter.sol/Greeter.json";
  4. import { Accounts, Signers } from "../types";
  5. import { Greeter } from "../typechain/Greeter";
  6. import { shouldBehaveLikeGreeter } from "./Greeter.behavior";
  7. const { deployContract } = waffle;
  8. describe("Unit tests", function () {
  9. before(async function () {
  10. this.accounts = {} as Accounts;
  11. this.signers = {} as Signers;
  12. const signers: Signer[] = await ethers.getSigners();
  13. this.signers.admin = signers[0];
  14. this.accounts.admin = await signers[0].getAddress();
  15. });
  16. describe("Greeter", function () {
  17. beforeEach(async function () {
  18. const greeting: string = "Hello, world!";
  19. this.greeter = (await deployContract(this.signers.admin, GreeterArtifact, [greeting])) as Greeter;
  20. });
  21. shouldBehaveLikeGreeter();
  22. });
  23. });