PatrickAlphaC / hardhat-smartcontract-lottery-fcc

MIT License
117 stars 182 forks source link

Hardhat test not running any tests (despite removing async) #160

Closed sohjag closed 1 year ago

sohjag commented 1 year ago

The following code is not running any tests.

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

!developmentChains.includes(network.name)
    ? describe.skip
    : describe("Raffle Unit Tests", function () {
          let raffle, vrfCoordinatorV2Mock
          beforeEach(async () => {
              const deployer = await getNamedAccounts()
              await deployments.fixture(["all"])
              raffle = await ethers.getContract("Raffle", deployer)
              vrfCoordinatorV2Mock = await ethers.getContract("VRFCoordinatorV2Mock", deployer)
          })
          describe("Constructor", function () {
              it("initializes raffle correctly", async () => {
                  const raffleState = await raffle.getRaffleState()
                  const interval = await raffle.getInterval()
                  assert.equal(raffleState, "0")
                  assert.equal(interval.toString(), networkConfig[chainId]["interval"])
              })
          })
      })

Here's the output

                                               │
··············|··········|··············|·············|·············|·············|················
|  Contract   ·  Method  ·  Min         ·  Max        ·  Avg        ·  # calls    ·  eur (avg)    │
·-------------|----------|--------------|-------------|-------------|-------------|---------------·
  0 passing (12ms)
sohjag commented 1 year ago

My project folder structure got messed up! Not an issue