From d0a22afc3d7579caa2b224a312563f2f2e1b7fb4 Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Thu, 4 Nov 2021 10:18:09 +0100 Subject: [PATCH] Extract mining test helpers to separate module --- test/Proofs.test.js | 9 +-------- test/mining.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 test/mining.js diff --git a/test/Proofs.test.js b/test/Proofs.test.js index acb5341..1e21f52 100644 --- a/test/Proofs.test.js +++ b/test/Proofs.test.js @@ -1,5 +1,6 @@ const { expect } = require("chai") const { ethers } = require("hardhat") +const { mineBlock, minedBlockNumber } = require ("./mining") describe("Proofs", function () { @@ -15,14 +16,6 @@ describe("Proofs", function () { 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() { await proofs.expectProofs(id, period, timeout, duration) expect(await proofs.period(id)).to.equal(period) diff --git a/test/mining.js b/test/mining.js new file mode 100644 index 0000000..b177060 --- /dev/null +++ b/test/mining.js @@ -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 }