0.5.0 • Published 1 year ago

@ape.swap/hardhat-test-helpers v0.5.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

ApeSwap Hardhat Test Helper

lint & test Docs License

Install this package to get access to deployable ApeSwap Mock Farm and DEX for testing with contracts developed with the Hardhat framework.

Installation

yarn add -D @ape.swap/hardhat-test-helpers

Usage

import { loadFixture } from '@nomicfoundation/hardhat-network-helpers'
import { dex, farm } from '@ape.swap/hardhat-test-helpers'

async function deployMockDexFixture() {
  const [owner, feeTo, alice] = await ethers.getSigners()

  const { dexFactory, dexRouter, mockWBNB, mockTokens, dexPairs } =
    await dex.deployMockDex(ethers, [owner, feeTo, alice], 5)

  return {
    accounts: { owner, feeTo, alice },
    dexFactory,
    dexRouter,
    mockWBNB,
    mockTokens,
    dexPairs,
  }
}

it("Should set the right unlockTime", async function () {
  const { accounts, dexRouter, dexFactory } = await loadFixture(deployMockDexFixture);

  expect(await dexRouter.factory()).to.equal(dexFactory.address);
});