const { assert, expect } = require("chai");
const { getNamedAccounts, ethers, network } = require("hardhat");
const { developmentChains } = require("../../helper-hardhat-config");
developmentChains.includes(network.name)
? describe.skip
: describe("Raffle Staging Tests", function () {
let raffle, raffleEntranceFee, deployer;
beforeEach(async function () {
deployer = (await getNamedAccounts()).deployer;
raffle = await ethers.getContract("Raffle", deployer);
raffleEntranceFee = await raffle.getEntranceFee();
});
describe("fulfillRandomWords", function () {
it("works with live Chainlink Keepers and Chainlink VRF, we get a random winner", async function () {
// enter the raffle
console.log("Setting up test...");
const startingTimeStamp = await raffle.getLastTimeStamp();
const accounts = await ethers.getSigners();
console.log("Setting up Listener...");
await new Promise(async (resolve, reject) => {
// setup listener before we enter the raffle
// Just in case the blockchain moves REALLY fast
raffle.once("WinnerPicked", async () => {
console.log("WinnerPicked event fired!");
try {
// add our asserts here
const recentWinner = await raffle.getRecentWinner();
const raffleState = await raffle.getRaffleState();
const winnerEndingBalance = await accounts[0].getBalance();
const endingTimeStamp = await raffle.getLastTimeStamp();
await expect(raffle.getPlayer(0)).to.be.reverted;
assert.equal(recentWinner.toString(), accounts[0].address);
assert.equal(raffleState, 0);
assert.equal(
winnerEndingBalance.toString(),
winnerStartingBalance.add(raffleEntranceFee).toString()
);
assert(endingTimeStamp > startingTimeStamp);
resolve();
} catch (error) {
console.log(error);
reject(error);
}
});
// Then entering the raffle
console.log("Entering Raffle...");
const tx = await raffle.enterRaffle({ value: raffleEntranceFee });
await tx.wait(1);
console.log("Ok, time to wait...");
const winnerStartingBalance = await accounts[0].getBalance();
// and this code WONT complete until our listener has finished listening!
});
});
});
});
I am facing this error here: 1) Raffle Staging Tests "before each" hook for "works with live Chainlink Keepers and Chainlink VRF, we get a random winner": Error: No Contract deployed with name Raffle at Object.getContract (node_modules/@nomiclabs/hardhat-ethers/src/internal/helpers.ts:447:11) at processTicksAndRejections (node:internal/process/task_queues:96:5) at Context. (test/staging/Raffle.staging.test.js:12:18)
can anybody help me out with this?