From 19d09c2bbbdfb980acb0fc269d0d60400acf677e Mon Sep 17 00:00:00 2001 From: Paul <108695806+pxrl@users.noreply.github.com> Date: Thu, 5 Sep 2024 00:52:54 +0200 Subject: [PATCH] Cleanup test --- test/BigNumberUtils.test.ts | 15 +++++++-------- test/poolClient.test.ts | 2 +- test/utils/utils.ts | 4 +++- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/test/BigNumberUtils.test.ts b/test/BigNumberUtils.test.ts index dd7c65319..3835ecade 100644 --- a/test/BigNumberUtils.test.ts +++ b/test/BigNumberUtils.test.ts @@ -1,12 +1,11 @@ -import { ethers } from "ethers"; -import { toWei, toGWei, toBN } from "../src/utils/BigNumberUtils"; +import { BigNumber, parseEther, parseUnits, toWei, toGWei, toBN } from "../src/utils/BigNumberUtils"; import { expect } from "./utils"; describe("BigNumberUtils", () => { describe("toWei", () => { it("should convert a stringified number to a BigNumber with 18 decimal places", () => { const num = "123.456"; - const expected = ethers.utils.parseEther(num); + const expected = parseEther(num); const result = toWei(num); expect(result).to.be.deep.includes(expected); }); @@ -15,7 +14,7 @@ describe("BigNumberUtils", () => { describe("toGWei", () => { it("should convert a stringified number to a BigNumber with 9 decimal places", () => { const num = "123.456"; - const expected = ethers.utils.parseUnits(num, 9); + const expected = parseUnits(num, 9); const result = toGWei(num); expect(result).to.be.deep.includes(expected); }); @@ -24,28 +23,28 @@ describe("BigNumberUtils", () => { describe("toBN", () => { it("should convert a stringified integer to a BigNumber", () => { const num = "123456"; - const expected = ethers.BigNumber.from(num); + const expected = BigNumber.from(num); const result = toBN(num); expect(result).to.be.deep.includes(expected); }); it("should convert a stringified number with decimal places to a BigNumber and round down by default", () => { const num = "123.456"; - const expected = ethers.BigNumber.from("123"); + const expected = BigNumber.from("123"); const result = toBN(num); expect(result).to.be.deep.includes(expected); }); it("should round up if rounding is set to 'ceil'", () => { const num = "123.456"; - const expected = ethers.BigNumber.from("124"); + const expected = BigNumber.from("124"); const result = toBN(num, "ceil"); expect(result).to.be.deep.includes(expected); }); it("should round up if rounding is set to 'round' and the first decimal is greater than or equal to 5", () => { const num = "123.556"; - const expected = ethers.BigNumber.from("124"); + const expected = BigNumber.from("124"); const result = toBN(num, "round"); expect(result).to.be.deep.includes(expected); }); diff --git a/test/poolClient.test.ts b/test/poolClient.test.ts index a4cd3a7df..389704934 100644 --- a/test/poolClient.test.ts +++ b/test/poolClient.test.ts @@ -1,5 +1,5 @@ import * as poolClient from "../src/pool/poolClient"; -import { BigNumber } from "ethers"; +import { BigNumber } from "../src/utils"; import { expect } from "./utils"; describe("poolClient", function () { diff --git a/test/utils/utils.ts b/test/utils/utils.ts index f65057338..7a2c8df30 100644 --- a/test/utils/utils.ts +++ b/test/utils/utils.ts @@ -1,5 +1,5 @@ import * as utils from "@across-protocol/contracts/dist/test-utils"; -import { BigNumber, BigNumberish, Contract, providers } from "ethers"; +import { Contract, providers } from "ethers"; import { AcrossConfigStoreClient as ConfigStoreClient, GLOBAL_CONFIG_STORE_KEYS, @@ -15,6 +15,8 @@ import { V2Fill, } from "../../src/interfaces"; import { + BigNumber, + BigNumberish, bnUint32Max, bnOne, getCurrentTime,