Skip to content

How to write hardhat test for fallback and receive functions #6151

Answered by muhammet72
muhammet72 asked this question in Q&A
Discussion options

You must be logged in to vote

it worked this is the updated test.js for falback

const { network, getNamedAccounts, deployments, ethers } = require("hardhat")
const { developmentChains, networkConfig } = require("../helper-hardhat-config")
const { assert, expect } = require("chai")

describe("Fallback", async () => {
  let fallback
  let accounts = []
  let sender

  beforeEach(async () => {
    ;[deployer, sender] = await ethers.getSigners()
    deployer = (await getNamedAccounts()).deployer
    await deployments.fixture(["all"])
    fallback = await ethers.getContract("Fallback", deployer)
  })

  describe("fallback", async () => {
    it("should receive Ether using fallback function", async function () {
      const…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by muhammet72
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant