diff options
author | Sebastian <sebasjm@gmail.com> | 2022-11-16 16:04:52 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-11-16 16:05:13 -0300 |
commit | 1a63d56bfdd091cc7aefdf1e25f3a074bfdf5e0e (patch) | |
tree | 7255cf4a5b51af4807e2a01a370497413a78968f /packages/taler-wallet-webextension/src/cta/Tip | |
parent | 53164dc47b1138235a0c797affaa6fb37ea43239 (diff) | |
download | wallet-core-1a63d56bfdd091cc7aefdf1e25f3a074bfdf5e0e.tar.xz |
fix #7411, also making the backup payment visible
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/Tip')
3 files changed, 18 insertions, 15 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/Tip/index.ts b/packages/taler-wallet-webextension/src/cta/Tip/index.ts index 520d854f2..ff917008f 100644 --- a/packages/taler-wallet-webextension/src/cta/Tip/index.ts +++ b/packages/taler-wallet-webextension/src/cta/Tip/index.ts @@ -25,7 +25,7 @@ import { AcceptedView, IgnoredView, LoadingUriView, - ReadyView + ReadyView, } from "./views.js"; export interface Props { diff --git a/packages/taler-wallet-webextension/src/cta/Tip/state.ts b/packages/taler-wallet-webextension/src/cta/Tip/state.ts index 00e1fddad..ea9ba1b37 100644 --- a/packages/taler-wallet-webextension/src/cta/Tip/state.ts +++ b/packages/taler-wallet-webextension/src/cta/Tip/state.ts @@ -26,7 +26,9 @@ export function useComponentState( ): State { const tipInfo = useAsyncAsHook(async () => { if (!talerTipUri) throw Error("ERROR_NO-URI-FOR-TIP"); - const tip = await api.wallet.call(WalletApiOperation.PrepareTip, { talerTipUri }); + const tip = await api.wallet.call(WalletApiOperation.PrepareTip, { + talerTipUri, + }); return { tip }; }); @@ -46,7 +48,9 @@ export function useComponentState( const { tip } = tipInfo.response; const doAccept = async (): Promise<void> => { - const res = await api.wallet.call(WalletApiOperation.AcceptTip, { walletTipId: tip.walletTipId }); + const res = await api.wallet.call(WalletApiOperation.AcceptTip, { + walletTipId: tip.walletTipId, + }); //FIX: this may not be seen since we are moving to the success also tipInfo.retry(); diff --git a/packages/taler-wallet-webextension/src/cta/Tip/test.ts b/packages/taler-wallet-webextension/src/cta/Tip/test.ts index 69badbede..e57b9ec4d 100644 --- a/packages/taler-wallet-webextension/src/cta/Tip/test.ts +++ b/packages/taler-wallet-webextension/src/cta/Tip/test.ts @@ -65,11 +65,10 @@ describe("Tip CTA states", () => { } await assertNoPendingUpdate(); - expect(handler.getCallingQueueState()).eq("empty") + expect(handler.getCallingQueueState()).eq("empty"); }); it("should be ready for accepting the tip", async () => { - const { handler, mock } = createWalletApiMock(); handler.addWalletCallResponse(WalletApiOperation.PrepareTip, undefined, { @@ -79,9 +78,9 @@ describe("Tip CTA states", () => { tipAmountEffective: "EUR:1", walletTipId: "tip_id", expirationTimestamp: { - t_s: 1 + t_s: 1, }, - tipAmountRaw: "" + tipAmountRaw: "", }); const { pullLastResultOrThrow, waitForStateUpdate, assertNoPendingUpdate } = @@ -112,7 +111,7 @@ describe("Tip CTA states", () => { const state = pullLastResultOrThrow(); if (state.status !== "ready") { - expect(state).eq({ status: "ready" }) + expect(state).eq({ status: "ready" }); return; } if (state.error) expect.fail(); @@ -132,9 +131,9 @@ describe("Tip CTA states", () => { tipAmountEffective: "EUR:1", walletTipId: "tip_id", expirationTimestamp: { - t_s: 1 + t_s: 1, }, - tipAmountRaw: "" + tipAmountRaw: "", }); expect(await waitForStateUpdate()).true; @@ -142,7 +141,7 @@ describe("Tip CTA states", () => { const state = pullLastResultOrThrow(); if (state.status !== "accepted") { - expect(state).eq({ status: "accepted" }) + expect(state).eq({ status: "accepted" }); return; } if (state.error) expect.fail(); @@ -151,7 +150,7 @@ describe("Tip CTA states", () => { expect(state.exchangeBaseUrl).eq("exchange url"); } await assertNoPendingUpdate(); - expect(handler.getCallingQueueState()).eq("empty") + expect(handler.getCallingQueueState()).eq("empty"); }); it("should be ignored after clicking the ignore button", async () => { @@ -165,7 +164,7 @@ describe("Tip CTA states", () => { expirationTimestamp: { t_s: 1, }, - tipAmountRaw: "" + tipAmountRaw: "", }); const { pullLastResultOrThrow, waitForStateUpdate, assertNoPendingUpdate } = @@ -203,7 +202,7 @@ describe("Tip CTA states", () => { } await assertNoPendingUpdate(); - expect(handler.getCallingQueueState()).eq("empty") + expect(handler.getCallingQueueState()).eq("empty"); }); it("should render accepted if the tip has been used previously", async () => { @@ -255,6 +254,6 @@ describe("Tip CTA states", () => { expect(state.exchangeBaseUrl).eq("exchange url"); } await assertNoPendingUpdate(); - expect(handler.getCallingQueueState()).eq("empty") + expect(handler.getCallingQueueState()).eq("empty"); }); }); |