-
I checked helper-hardhat-config.js and deploy-raffle.js Raffle-test.js const { assert, expect } = require("chai")
const { network, deployments, ethers } = require("hardhat")
const { developmentChains, networkConfig } = require("../../helper-hardhat-config")
!network.config.chainId == 31337
? describe.skip
: describe("Raffle Unit test", function () {
let player, vrfCoordinatorV2Mock, raffle, raffleContract, raffleEntranceFee, interval
beforeEach(async () => {
accounts = await ethers.getSigners()
player = accounts[1] // accounts[1] is deployer
await deployments.fixture(["mocks", "raffle"])
vrfCoordinatorV2Mock = await ethers.getContract("VRFCoordinatorV2Mock")
raffleContract = await ethers.getContract("Raffle")
raffle = await raffleContract.connect(player)
raffleEntranceFee = await raffle.getEntranceFee()
interval = await raffle.getInterval()
})
describe("constructor", function () {
it("intitiallizes the raffle correctly", async () => {
const raffleState = (await raffle.getRaffleState()).toString()
console.log(interval.toString())
assert.equal(raffleState, "0")
assert.equal(
interval.toString(),
networkConfig[network.config.chainId]["keepersUpdateInterval"]
)
})
}) |
Beta Was this translation helpful? Give feedback.
Answered by
krakxn
Jul 30, 2022
Replies: 2 comments 16 replies
-
Make a repo -- I will look into it |
Beta Was this translation helpful? Give feedback.
8 replies
Answer selected by
zulfi984
-
Remove this lines accounts = await ethers.getSigners()
player = accounts[1] // accounts[1] is deployer
raffle = await raffleContract.connect(player) as the contract is already connected to the deployer. raffleContract = await ethers.getContract("Raffle") to raffleContract = await ethers.getContract("Raffle",deployer) You can get deployer by importing getNamedAccounts from hardhat deployer = (await getNamedAccounts()).deployer; And then your code should work fine. |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make a repo -- I will look into it