sample-test.js 619 B

12345678910111213141516171819
  1. const { expect } = require("chai");
  2. const { ethers } = require("hardhat");
  3. describe("Greeter", function () {
  4. it("Should return the new greeting once it's changed", async function () {
  5. const Greeter = await ethers.getContractFactory("Greeter");
  6. const greeter = await Greeter.deploy("Hello, world!");
  7. await greeter.deployed();
  8. expect(await greeter.greet()).to.equal("Hello, world!");
  9. const setGreetingTx = await greeter.setGreeting("Hola, mundo!");
  10. // wait until the transaction is mined
  11. await setGreetingTx.wait();
  12. expect(await greeter.greet()).to.equal("Hola, mundo!");
  13. });
  14. });