sanity.test.js 776 B

123456789101112131415161718192021222324252627
  1. const { ethers } = require('hardhat');
  2. const { expect } = require('chai');
  3. const { loadFixture, mine } = require('@nomicfoundation/hardhat-network-helpers');
  4. async function fixture() {
  5. return {};
  6. }
  7. describe('Environment sanity', function () {
  8. beforeEach(async function () {
  9. Object.assign(this, await loadFixture(fixture));
  10. });
  11. describe('snapshot', function () {
  12. let blockNumberBefore;
  13. it('cache and mine', async function () {
  14. blockNumberBefore = await ethers.provider.getBlockNumber();
  15. await mine();
  16. expect(await ethers.provider.getBlockNumber()).to.equal(blockNumberBefore + 1);
  17. });
  18. it('check snapshot', async function () {
  19. expect(await ethers.provider.getBlockNumber()).to.equal(blockNumberBefore);
  20. });
  21. });
  22. });