Greeter.ts 881 B

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