import { hasClaimableRewards } from "./rewards"; import { BigNumber } from "ethers"; const pendingRewardWithValue = (amount: number) => ({ tokenAddress: "0x0000000", amount: BigNumber.from("" + amount * 1e18), }); describe("hasClaimableRewards", () => { it("should return true if there are claimable rewards", () => { expect( hasClaimableRewards({ pendingRewards: [ pendingRewardWithValue(0.001), pendingRewardWithValue(0), ], }) ).toBeTruthy(); }); it("should return false if there are no claimable rewards", () => { expect( hasClaimableRewards({ pendingRewards: [pendingRewardWithValue(0), pendingRewardWithValue(0)], }) ).toBeFalsy(); }); it("should return false if there are no rewards", () => { expect( hasClaimableRewards({ pendingRewards: [], }) ).toBeFalsy(); }); });