Extract mining test helpers to separate module
This commit is contained in:
parent
6de82709ca
commit
d0a22afc3d
|
@ -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)
|
||||||
|
|
|
@ -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 }
|
Loading…
Reference in New Issue