diff --git a/libs/coin-framework/src/account/helpers.test.ts b/libs/coin-framework/src/account/helpers.test.ts index 0cec6c7fd07d..f8dc78d97a89 100644 --- a/libs/coin-framework/src/account/helpers.test.ts +++ b/libs/coin-framework/src/account/helpers.test.ts @@ -159,6 +159,36 @@ describe(isAccountEmpty.name, () => { expect(isAccountEmpty(mockAccount)).toEqual(false); }); }); + describe("when account has subaccounts", () => { + beforeEach(() => { + mockAccount.subAccounts = [{} as TokenAccount]; + }); + + it("should return false", () => { + expect(isAccountEmpty(mockAccount)).toEqual(false); + }); + }); + }); + describe("given an solana account", () => { + beforeEach(() => { + mockAccount.type = "Account"; + mockAccount.currency = { family: "solana" } as CryptoCurrency; + }); + it("Account has balance and spendableBalance is zero ", () => { + mockAccount.balance = new BigNumber(10); + mockAccount.spendableBalance = new BigNumber(0); + expect(isAccountEmpty(mockAccount)).toEqual(true); + }); + it("Account has spendableBalance and balance is zero", () => { + mockAccount.balance = new BigNumber(0); + mockAccount.spendableBalance = new BigNumber(10); + expect(isAccountEmpty(mockAccount)).toEqual(true); + }); + it("Account has spendableBalance and has balance", () => { + mockAccount.balance = new BigNumber(10); + mockAccount.spendableBalance = new BigNumber(10); + expect(isAccountEmpty(mockAccount)).toEqual(false); + }); }); });