Extract mining test helpers to separate module

This commit is contained in:
Mark Spanbroek 2021-11-04 10:18:09 +01:00
parent 6de82709ca
commit d0a22afc3d
2 changed files with 12 additions and 8 deletions

View File

@ -1,5 +1,6 @@
const { expect } = require("chai") const { expect } = require("chai")
const { ethers } = require("hardhat") const { ethers } = require("hardhat")
const { mineBlock, minedBlockNumber } = require ("./mining")
describe("Proofs", function () { describe("Proofs", function () {
@ -15,14 +16,6 @@ describe("Proofs", function () {
proofs = await Proofs.deploy() proofs = await Proofs.deploy()
}) })
async function mineBlock() {
await ethers.provider.send("evm_mine")
}
async function minedBlockNumber() {
return await ethers.provider.getBlockNumber()
}
it("indicates that proofs are required", async function() { it("indicates that proofs are required", async function() {
await proofs.expectProofs(id, period, timeout, duration) await proofs.expectProofs(id, period, timeout, duration)
expect(await proofs.period(id)).to.equal(period) expect(await proofs.period(id)).to.equal(period)

11
test/mining.js Normal file
View File

@ -0,0 +1,11 @@
const { ethers } = require("hardhat")
async function mineBlock() {
await ethers.provider.send("evm_mine")
}
async function minedBlockNumber() {
return await ethers.provider.getBlockNumber()
}
module.exports = { mineBlock, minedBlockNumber }