diff options
author | Sebastian <sebasjm@gmail.com> | 2022-10-25 19:20:22 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-10-25 19:20:22 -0300 |
commit | c747ae60360db48482265db1a7e836410a632ce8 (patch) | |
tree | b5e88417093e2c746e1a660a4d116e961e3bcf89 /packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts | |
parent | 3f2db7707fdf4eb4c1dfdb527d5726dd1694e126 (diff) | |
parent | 3685f8cfb87ec0a10a97324bed1135b32707e1ee (diff) | |
download | wallet-core-c747ae60360db48482265db1a7e836410a632ce8.tar.xz |
Merge commit '3685f8cf' into HEAD
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts')
-rw-r--r-- | packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts | 99 |
1 files changed, 68 insertions, 31 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts b/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts index 4d36bc740..62097c3e4 100644 --- a/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts +++ b/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts @@ -239,44 +239,81 @@ describe("DepositPage states", () => { 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"); - } - - expect(await waitForStateUpdate()).true; - - { - 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; - - r.amount.onInput("3"); - } - - expect(await waitForStateUpdate()).true; - - { - 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; } await assertNoPendingUpdate(); - expect(handler.getCallingQueueState()).eq("empty") }); + // 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<BalancesResponse>), + // listKnownBankAccounts: async () => ({ accounts: [ibanPayto] }), + // getFeeForDeposit: withSomeFee, + // } as Partial<typeof wxApi> 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(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"); + // } + + // expect(await waitForStateUpdate()).true; + + // { + // 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; + + // r.amount.onInput("3"); + // } + + // expect(await waitForStateUpdate()).true; + + // { + // 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; + // } + + // 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 } |