Skip to content

Commit

Permalink
refactor: Extract asset address
Browse files Browse the repository at this point in the history
  • Loading branch information
karelianpie committed Feb 16, 2022
1 parent b0134ec commit e7be836
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/interfaces/earnings.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getAddress } from "@ethersproject/address";
import BigNumber from "bignumber.js";

import { AssetHistoricEarnings, ChainId, EarningsInterface, SdkError, Usdc, VaultStatic } from "..";
import { Address, AssetHistoricEarnings, ChainId, EarningsInterface, SdkError, Usdc, VaultStatic } from "..";
import { Context } from "../context";
import { createMockAssetHistoricEarnings, createMockAssetStaticVaultV2 } from "../test-utils/factories";
import { Yearn } from "../yearn";
Expand Down Expand Up @@ -120,6 +120,8 @@ describe("EarningsInterface", () => {
});

describe("when there is data", () => {
const assetAddress: Address = "0x001";

beforeEach(() => {
getAddressMock.mockReturnValue("0x001");
oracleGetPriceUsdcMock.mockResolvedValueOnce("3.5");
Expand All @@ -139,7 +141,7 @@ describe("EarningsInterface", () => {
});

it("should return the asset earnings", async () => {
const actualAssetEarnings = await earningsInterface.assetEarnings("0x001");
const actualAssetEarnings = await earningsInterface.assetEarnings(assetAddress);

expect(actualAssetEarnings).toEqual({
amount: "2000000000000000000",
Expand All @@ -151,7 +153,7 @@ describe("EarningsInterface", () => {
expect(oracleGetPriceUsdcMock).toHaveBeenCalledWith("vaultTokenId");

expect(getAddress).toHaveBeenCalledTimes(2);
expect(getAddress).toHaveBeenNthCalledWith(1, "0x001");
expect(getAddress).toHaveBeenNthCalledWith(1, assetAddress);
expect(getAddress).toHaveBeenNthCalledWith(2, "vaultTokenId");
});
});
Expand Down

0 comments on commit e7be836

Please sign in to comment.