Greeter.ts 920 B

12345678910111213141516171819202122232425262728
  1. import hre from "hardhat";
  2. import { Artifact } from "hardhat/types";
  3. import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address";
  4. import { Greeter } from "../../types/Greeter";
  5. import { Signers } from "../types";
  6. import { shouldBehaveLikeGreeter } from "./Greeter.behavior";
  7. const { deployContract } = hre.waffle;
  8. describe("Unit tests", function () {
  9. before(async function () {
  10. this.signers = {} as Signers;
  11. const signers: SignerWithAddress[] = await hre.ethers.getSigners();
  12. this.signers.admin = signers[0];
  13. });
  14. describe("Greeter", function () {
  15. beforeEach(async function () {
  16. const greeting: string = "Hello, world!";
  17. const greeterArtifact: Artifact = await hre.artifacts.readArtifact("Greeter");
  18. this.greeter = <Greeter>await deployContract(this.signers.admin, greeterArtifact, [greeting]);
  19. });
  20. shouldBehaveLikeGreeter();
  21. });
  22. });