From a286649b0a611d87916a178a795c1acd2917741c Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 25 Oct 2022 12:23:08 -0300 Subject: cherry-pick: using new wallet typed api missing test --- .../src/wallet/DepositPage/test.ts | 549 ++++++++------------- 1 file changed, 210 insertions(+), 339 deletions(-) (limited to 'packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts') diff --git a/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts b/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts index 57822cfd0..62097c3e4 100644 --- a/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts +++ b/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts @@ -20,101 +20,108 @@ */ import { - Amounts, - Balance, - BalancesResponse, - DepositGroupFees, + Amounts, DepositGroupFees, parsePaytoUri, - stringifyPaytoUri, + stringifyPaytoUri } from "@gnu-taler/taler-util"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { expect } from "chai"; -import { mountHook } from "../../test-utils.js"; +import { createWalletApiMock, mountHook, nullFunction } from "../../test-utils.js"; -import * as wxApi from "../../wxApi.js"; import { useComponentState } from "./state.js"; const currency = "EUR"; -const withoutFee = async (): Promise => ({ +const withoutFee = (): DepositGroupFees => ({ coin: Amounts.parseOrThrow(`${currency}:0`), wire: Amounts.parseOrThrow(`${currency}:0`), refresh: Amounts.parseOrThrow(`${currency}:0`), }); -const withSomeFee = async (): Promise => ({ +const withSomeFee = (): DepositGroupFees => ({ coin: Amounts.parseOrThrow(`${currency}:1`), wire: Amounts.parseOrThrow(`${currency}:1`), refresh: Amounts.parseOrThrow(`${currency}:1`), }); -const freeJustForIBAN = async (account: string): Promise => - /IBAN/i.test(account) ? withSomeFee() : withoutFee(); - -const someBalance = [ - { - available: "EUR:10", - } as Balance, -]; - -const nullFunction: any = () => null; -type VoidFunction = () => void; - describe("DepositPage states", () => { it("should have status 'no-enough-balance' when balance is empty", async () => { - const { getLastResultOrThrow, waitNextUpdate, assertNoPendingUpdate } = + const { handler, mock } = createWalletApiMock(); + const props = { currency, onCancel: nullFunction, onSuccess: nullFunction } + + handler.addWalletCallResponse(WalletApiOperation.GetBalances, undefined, { + balances: [{ + available: `${currency}:0`, + hasPendingTransactions: false, + pendingIncoming: `${currency}:0`, + pendingOutgoing: `${currency}:0`, + requiresUserInput: false, + }], + }) + handler.addWalletCallResponse(WalletApiOperation.ListKnownBankAccounts, undefined, { + accounts: [] + }); + + const { pullLastResultOrThrow, waitForStateUpdate, assertNoPendingUpdate } = mountHook(() => useComponentState( - { currency, onCancel: nullFunction, onSuccess: nullFunction }, - { - getBalance: async () => - ({ - balances: [{ available: `${currency}:0` }], - } as Partial), - listKnownBankAccounts: async () => ({ accounts: {} }), - } as Partial as any, + props, mock ), ); { - const { status } = getLastResultOrThrow(); + const { status } = pullLastResultOrThrow(); expect(status).equal("loading"); } - await waitNextUpdate(); + expect(await waitForStateUpdate()).true; { - const { status } = getLastResultOrThrow(); + const { status } = pullLastResultOrThrow(); expect(status).equal("no-enough-balance"); } await assertNoPendingUpdate(); + expect(handler.getCallingQueueState()).eq("empty") }); - // it("should have status 'no-accounts' when balance is not empty and accounts is empty", async () => { - // const { getLastResultOrThrow, waitNextUpdate, assertNoPendingUpdate } = - // mountHook(() => - // useComponentState({ currency, onCancel: nullFunction, onSuccess: nullFunction }, { - // getBalance: async () => - // ({ - // balances: [{ available: `${currency}:1` }], - // } as Partial), - // listKnownBankAccounts: async () => ({ accounts: {} }), - // } as Partial as any), - // ); + it("should have status 'no-accounts' when balance is not empty and accounts is empty", async () => { + const { handler, mock } = createWalletApiMock(); + const props = { currency, onCancel: nullFunction, onSuccess: nullFunction } + + handler.addWalletCallResponse(WalletApiOperation.GetBalances, undefined, { + balances: [{ + available: `${currency}:1`, + hasPendingTransactions: false, + pendingIncoming: `${currency}:0`, + pendingOutgoing: `${currency}:0`, + requiresUserInput: false, + }], + }) + handler.addWalletCallResponse(WalletApiOperation.ListKnownBankAccounts, undefined, { + accounts: [] + }); + const { pullLastResultOrThrow, waitForStateUpdate, assertNoPendingUpdate } = + mountHook(() => + useComponentState( + props, mock + ) + ); - // { - // const { status } = getLastResultOrThrow(); - // expect(status).equal("loading"); - // } + { + const { status } = pullLastResultOrThrow(); + expect(status).equal("loading"); + } - // await waitNextUpdate(); - // { - // const r = getLastResultOrThrow(); - // if (r.status !== "no-accounts") expect.fail(); - // expect(r.cancelHandler.onClick).not.undefined; - // } + expect(await waitForStateUpdate()).true; + { + const r = pullLastResultOrThrow(); + if (r.status !== "no-accounts") expect.fail(); + // expect(r.cancelHandler.onClick).not.undefined; + } - // await assertNoPendingUpdate(); - // }); + await assertNoPendingUpdate(); + expect(handler.getCallingQueueState()).eq("empty") + }); const ibanPayto = { uri: parsePaytoUri("payto://iban/ES8877998399652238")!, @@ -130,29 +137,38 @@ describe("DepositPage states", () => { }; it("should have status 'ready' but unable to deposit ", async () => { - const { getLastResultOrThrow, waitNextUpdate, assertNoPendingUpdate } = + const { handler, mock } = createWalletApiMock(); + const props = { currency, onCancel: nullFunction, onSuccess: nullFunction } + + handler.addWalletCallResponse(WalletApiOperation.GetBalances, undefined, { + balances: [{ + available: `${currency}:1`, + hasPendingTransactions: false, + pendingIncoming: `${currency}:0`, + pendingOutgoing: `${currency}:0`, + requiresUserInput: false, + }], + }) + handler.addWalletCallResponse(WalletApiOperation.ListKnownBankAccounts, undefined, { + accounts: [ibanPayto] + }); + + const { pullLastResultOrThrow, waitForStateUpdate, assertNoPendingUpdate } = mountHook(() => useComponentState( - { currency, onCancel: nullFunction, onSuccess: nullFunction }, - { - getBalance: async () => - ({ - balances: [{ available: `${currency}:1` }], - } as Partial), - listKnownBankAccounts: async () => ({ accounts: [ibanPayto] }), - } as Partial as any, + props, mock ), ); { - const { status } = getLastResultOrThrow(); + const { status } = pullLastResultOrThrow(); expect(status).equal("loading"); } - await waitNextUpdate(); + expect(await waitForStateUpdate()).true; { - const r = getLastResultOrThrow(); + const r = pullLastResultOrThrow(); if (r.status !== "ready") expect.fail(); expect(r.cancelHandler.onClick).not.undefined; expect(r.currency).eq(currency); @@ -162,33 +178,46 @@ describe("DepositPage states", () => { } await assertNoPendingUpdate(); + expect(handler.getCallingQueueState()).eq("empty") }); - it.skip("should not be able to deposit more than the balance ", async () => { - const { getLastResultOrThrow, waitNextUpdate, assertNoPendingUpdate } = + it("should not be able to deposit more than the balance ", async () => { + const { handler, mock } = createWalletApiMock(); + const props = { currency, onCancel: nullFunction, onSuccess: nullFunction } + + handler.addWalletCallResponse(WalletApiOperation.GetBalances, undefined, { + balances: [{ + available: `${currency}:5`, + hasPendingTransactions: false, + pendingIncoming: `${currency}:0`, + pendingOutgoing: `${currency}:0`, + requiresUserInput: false, + }], + }) + handler.addWalletCallResponse(WalletApiOperation.ListKnownBankAccounts, undefined, { + accounts: [ibanPayto] + }); + handler.addWalletCallResponse(WalletApiOperation.GetFeeForDeposit, undefined, withoutFee()) + handler.addWalletCallResponse(WalletApiOperation.GetFeeForDeposit, undefined, withoutFee()) + handler.addWalletCallResponse(WalletApiOperation.GetFeeForDeposit, undefined, withoutFee()) + + const { pullLastResultOrThrow, waitForStateUpdate, assertNoPendingUpdate } = mountHook(() => useComponentState( - { currency, onCancel: nullFunction, onSuccess: nullFunction }, - { - getBalance: async () => - ({ - balances: [{ available: `${currency}:1` }], - } as Partial), - listKnownBankAccounts: async () => ({ accounts: [ibanPayto] }), - getFeeForDeposit: withoutFee, - } as Partial as any, + props, mock ), ); { - const { status } = getLastResultOrThrow(); + const { status } = pullLastResultOrThrow(); expect(status).equal("loading"); } - await waitNextUpdate(); + expect(await waitForStateUpdate()).true; + const accountSelected = stringifyPaytoUri(ibanPayto.uri) { - const r = getLastResultOrThrow(); + const r = pullLastResultOrThrow(); if (r.status !== "ready") expect.fail(); expect(r.cancelHandler.onClick).not.undefined; expect(r.currency).eq(currency); @@ -196,32 +225,20 @@ describe("DepositPage states", () => { expect(r.amount.value).eq("0"); expect(r.depositHandler.onClick).undefined; expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); + expect(r.account.onChange).not.undefined; - r.amount.onInput("10"); + r.account.onChange!(accountSelected) } - await waitNextUpdate(); + expect(await waitForStateUpdate()).true; { - const r = getLastResultOrThrow(); + const r = pullLastResultOrThrow(); if (r.status !== "ready") expect.fail(); expect(r.cancelHandler.onClick).not.undefined; expect(r.currency).eq(currency); - expect(r.account.value).eq(""); - expect(r.amount.value).eq("10"); - expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); - expect(r.depositHandler.onClick).undefined; - } - - await waitNextUpdate(); - - { - const r = getLastResultOrThrow(); - if (r.status !== "ready") expect.fail(); - expect(r.cancelHandler.onClick).not.undefined; - expect(r.currency).eq(currency); - expect(r.account.value).eq(""); - expect(r.amount.value).eq("10"); + expect(r.account.value).eq(accountSelected); + expect(r.amount.value).eq("0"); expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); expect(r.depositHandler.onClick).undefined; } @@ -229,100 +246,110 @@ describe("DepositPage states", () => { await assertNoPendingUpdate(); }); - it.skip("should calculate the fee upon entering amount ", async () => { - const { getLastResultOrThrow, waitNextUpdate, assertNoPendingUpdate } = - mountHook(() => - useComponentState( - { currency, onCancel: nullFunction, onSuccess: nullFunction }, - { - getBalance: async () => - ({ - balances: [{ available: `${currency}:1` }], - } as Partial), - listKnownBankAccounts: async () => ({ accounts: [ibanPayto] }), - getFeeForDeposit: withSomeFee, - } as Partial as any, - ), - ); + // it("should calculate the fee upon entering amount ", async () => { + // const { pullLastResultOrThrow, waitForStateUpdate, assertNoPendingUpdate } = + // mountHook(() => + // useComponentState( + // { currency, onCancel: nullFunction, onSuccess: nullFunction }, + // { + // getBalance: async () => + // ({ + // balances: [{ available: `${currency}:1` }], + // } as Partial), + // listKnownBankAccounts: async () => ({ accounts: [ibanPayto] }), + // getFeeForDeposit: withSomeFee, + // } as Partial as any, + // ), + // ); - { - const { status } = getLastResultOrThrow(); - expect(status).equal("loading"); - } + // { + // const { status } = getLastResultOrThrow(); + // expect(status).equal("loading"); + // } - await waitNextUpdate(); + // await waitNextUpdate(); - { - const r = getLastResultOrThrow(); - if (r.status !== "ready") expect.fail(); - expect(r.cancelHandler.onClick).not.undefined; - expect(r.currency).eq(currency); - expect(r.account.value).eq(""); - expect(r.amount.value).eq("0"); - expect(r.depositHandler.onClick).undefined; - expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); + // { + // const r = getLastResultOrThrow(); + // if (r.status !== "ready") expect.fail(); + // expect(r.cancelHandler.onClick).not.undefined; + // expect(r.currency).eq(currency); + // expect(r.account.value).eq(accountSelected); + // expect(r.amount.value).eq("0"); + // expect(r.depositHandler.onClick).undefined; + // expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); - r.amount.onInput("10"); - } + // r.amount.onInput("10"); + // } - await waitNextUpdate(); + // expect(await waitForStateUpdate()).true; - { - const r = getLastResultOrThrow(); - if (r.status !== "ready") expect.fail(); - expect(r.cancelHandler.onClick).not.undefined; - expect(r.currency).eq(currency); - expect(r.account.value).eq(""); - expect(r.amount.value).eq("10"); - expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); - expect(r.totalToDeposit).deep.eq(Amounts.parseOrThrow(`${currency}:10`)); - expect(r.depositHandler.onClick).undefined; - } + // { + // const r = pullLastResultOrThrow(); + // if (r.status !== "ready") expect.fail(); + // expect(r.cancelHandler.onClick).not.undefined; + // expect(r.currency).eq(currency); + // expect(r.account.value).eq(accountSelected); + // expect(r.amount.value).eq("10"); + // expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); + // expect(r.depositHandler.onClick).undefined; - await waitNextUpdate(); + // r.amount.onInput("3"); + // } - { - const r = getLastResultOrThrow(); - if (r.status !== "ready") expect.fail(); - expect(r.cancelHandler.onClick).not.undefined; - expect(r.currency).eq(currency); - expect(r.account.value).eq(""); - expect(r.amount.value).eq("10"); - expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:3`)); - expect(r.totalToDeposit).deep.eq(Amounts.parseOrThrow(`${currency}:7`)); - expect(r.depositHandler.onClick).undefined; - } + // expect(await waitForStateUpdate()).true; - await assertNoPendingUpdate(); - }); + // { + // const r = pullLastResultOrThrow(); + // if (r.status !== "ready") expect.fail(); + // expect(r.cancelHandler.onClick).not.undefined; + // expect(r.currency).eq(currency); + // expect(r.account.value).eq(accountSelected); + // expect(r.amount.value).eq("3"); + // expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); + // expect(r.depositHandler.onClick).not.undefined; + // } - it.skip("should calculate the fee upon selecting account ", async () => { - const { getLastResultOrThrow, waitNextUpdate, assertNoPendingUpdate } = + // await assertNoPendingUpdate(); + // expect(handler.getCallingQueueState()).eq("empty") + // }); + + it("should calculate the fee upon entering amount ", async () => { + const { handler, mock } = createWalletApiMock(); + const props = { currency, onCancel: nullFunction, onSuccess: nullFunction } + + handler.addWalletCallResponse(WalletApiOperation.GetBalances, undefined, { + balances: [{ + available: `${currency}:10`, + hasPendingTransactions: false, + pendingIncoming: `${currency}:0`, + pendingOutgoing: `${currency}:0`, + requiresUserInput: false, + }], + }) + handler.addWalletCallResponse(WalletApiOperation.ListKnownBankAccounts, undefined, { + accounts: [ibanPayto] + }); + handler.addWalletCallResponse(WalletApiOperation.GetFeeForDeposit, undefined, withSomeFee()) + handler.addWalletCallResponse(WalletApiOperation.GetFeeForDeposit, undefined, withSomeFee()) + + const { pullLastResultOrThrow, waitForStateUpdate, assertNoPendingUpdate } = mountHook(() => useComponentState( - { currency, onCancel: nullFunction, onSuccess: nullFunction }, - { - getBalance: async () => - ({ - balances: [{ available: `${currency}:1` }], - } as Partial), - listKnownBankAccounts: async () => ({ - accounts: [ibanPayto, talerBankPayto], - }), - getFeeForDeposit: freeJustForIBAN, - } as Partial as any, + props, mock ), ); { - const { status } = getLastResultOrThrow(); + const { status } = pullLastResultOrThrow(); expect(status).equal("loading"); } - await waitNextUpdate(); + expect(await waitForStateUpdate()).true; + const accountSelected = stringifyPaytoUri(ibanPayto.uri) { - const r = getLastResultOrThrow(); + const r = pullLastResultOrThrow(); if (r.status !== "ready") expect.fail(); expect(r.cancelHandler.onClick).not.undefined; expect(r.currency).eq(currency); @@ -330,198 +357,42 @@ describe("DepositPage states", () => { expect(r.amount.value).eq("0"); expect(r.depositHandler.onClick).undefined; expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); - expect(r.totalToDeposit).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); + expect(r.account.onChange).not.undefined; - if (r.account.onChange === undefined) expect.fail(); - r.account.onChange(stringifyPaytoUri(ibanPayto.uri)); - } - - await waitNextUpdate(""); - - { - const r = getLastResultOrThrow(); - if (r.status !== "ready") expect.fail(); - expect(r.cancelHandler.onClick).not.undefined; - expect(r.currency).eq(currency); - expect(r.account.value).eq(stringifyPaytoUri(ibanPayto.uri)); - expect(r.amount.value).eq("0"); - expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); - expect(r.totalToDeposit).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); - expect(r.depositHandler.onClick).undefined; + r.account.onChange!(accountSelected) } - await waitNextUpdate(""); + expect(await waitForStateUpdate()).true; { - const r = getLastResultOrThrow(); + const r = pullLastResultOrThrow(); if (r.status !== "ready") expect.fail(); expect(r.cancelHandler.onClick).not.undefined; expect(r.currency).eq(currency); - expect(r.account.value).eq(stringifyPaytoUri(ibanPayto.uri)); + expect(r.account.value).eq(accountSelected); expect(r.amount.value).eq("0"); - expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:3`)); - expect(r.totalToDeposit).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); expect(r.depositHandler.onClick).undefined; - - r.amount.onInput("10"); - } - - await waitNextUpdate(""); - - { - const r = getLastResultOrThrow(); - if (r.status !== "ready") expect.fail(); - expect(r.cancelHandler.onClick).not.undefined; - expect(r.currency).eq(currency); - expect(r.account.value).eq(stringifyPaytoUri(ibanPayto.uri)); - expect(r.amount.value).eq("10"); expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:3`)); - expect(r.totalToDeposit).deep.eq(Amounts.parseOrThrow(`${currency}:7`)); - expect(r.depositHandler.onClick).undefined; - } - - await waitNextUpdate(""); - - { - const r = getLastResultOrThrow(); - if (r.status !== "ready") expect.fail(); - expect(r.cancelHandler.onClick).not.undefined; - expect(r.currency).eq(currency); - expect(r.account.value).eq(stringifyPaytoUri(ibanPayto.uri)); - expect(r.amount.value).eq("10"); - expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:3`)); - expect(r.totalToDeposit).deep.eq(Amounts.parseOrThrow(`${currency}:7`)); - expect(r.depositHandler.onClick).undefined; - - if (r.account.onChange === undefined) expect.fail(); - r.account.onChange(stringifyPaytoUri(talerBankPayto.uri)); - } - - await waitNextUpdate(""); - - { - const r = getLastResultOrThrow(); - if (r.status !== "ready") expect.fail(); - expect(r.cancelHandler.onClick).not.undefined; - expect(r.currency).eq(currency); - expect(r.account.value).eq(stringifyPaytoUri(talerBankPayto.uri)); - expect(r.amount.value).eq("10"); - expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:3`)); - expect(r.totalToDeposit).deep.eq(Amounts.parseOrThrow(`${currency}:7`)); - expect(r.depositHandler.onClick).undefined; - } - - await waitNextUpdate(""); - - { - const r = getLastResultOrThrow(); - if (r.status !== "ready") expect.fail(); - expect(r.cancelHandler.onClick).not.undefined; - expect(r.currency).eq(currency); - expect(r.account.value).eq(stringifyPaytoUri(talerBankPayto.uri)); - expect(r.amount.value).eq("10"); - expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); - expect(r.totalToDeposit).deep.eq(Amounts.parseOrThrow(`${currency}:10`)); - expect(r.depositHandler.onClick).undefined; - } - - await assertNoPendingUpdate(); - }); - - it.skip("should be able to deposit if has the enough balance ", async () => { - const { getLastResultOrThrow, waitNextUpdate, assertNoPendingUpdate } = - mountHook(() => - useComponentState( - { currency, onCancel: nullFunction, onSuccess: nullFunction }, - { - getBalance: async () => - ({ - balances: [{ available: `${currency}:15` }], - } as Partial), - listKnownBankAccounts: async () => ({ accounts: [ibanPayto] }), - getFeeForDeposit: withSomeFee, - } as Partial as any, - ), - ); - - { - const { status } = getLastResultOrThrow(); - expect(status).equal("loading"); - } - - await waitNextUpdate(); - - { - const r = getLastResultOrThrow(); - if (r.status !== "ready") expect.fail(); - expect(r.cancelHandler.onClick).not.undefined; - expect(r.currency).eq(currency); - expect(r.account.value).eq(""); - expect(r.amount.value).eq("0"); - expect(r.depositHandler.onClick).undefined; - expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); r.amount.onInput("10"); } - await waitNextUpdate(); + expect(await waitForStateUpdate()).true; { - const r = getLastResultOrThrow(); + const r = pullLastResultOrThrow(); if (r.status !== "ready") expect.fail(); expect(r.cancelHandler.onClick).not.undefined; expect(r.currency).eq(currency); - expect(r.account.value).eq(""); - expect(r.amount.value).eq("10"); - expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); - expect(r.totalToDeposit).deep.eq(Amounts.parseOrThrow(`${currency}:10`)); - expect(r.depositHandler.onClick).undefined; - } - - await waitNextUpdate(); - - { - const r = getLastResultOrThrow(); - if (r.status !== "ready") expect.fail(); - expect(r.cancelHandler.onClick).not.undefined; - expect(r.currency).eq(currency); - expect(r.account.value).eq(""); + expect(r.account.value).eq(accountSelected); expect(r.amount.value).eq("10"); expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:3`)); expect(r.totalToDeposit).deep.eq(Amounts.parseOrThrow(`${currency}:7`)); expect(r.depositHandler.onClick).not.undefined; - - r.amount.onInput("13"); - } - - await waitNextUpdate(); - - { - const r = getLastResultOrThrow(); - if (r.status !== "ready") expect.fail(); - expect(r.cancelHandler.onClick).not.undefined; - expect(r.currency).eq(currency); - expect(r.account.value).eq(""); - expect(r.amount.value).eq("13"); - expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:3`)); - expect(r.totalToDeposit).deep.eq(Amounts.parseOrThrow(`${currency}:10`)); - expect(r.depositHandler.onClick).not.undefined; - } - - await waitNextUpdate(); - - { - const r = getLastResultOrThrow(); - if (r.status !== "ready") expect.fail(); - expect(r.cancelHandler.onClick).not.undefined; - expect(r.currency).eq(currency); - expect(r.account.value).eq(""); - expect(r.amount.value).eq("13"); - expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:3`)); - expect(r.totalToDeposit).deep.eq(Amounts.parseOrThrow(`${currency}:10`)); - expect(r.depositHandler.onClick).not.undefined; } await assertNoPendingUpdate(); + expect(handler.getCallingQueueState()).eq("empty") }); + }); -- cgit v1.2.3