diff options
author | Sebastian <sebasjm@gmail.com> | 2022-09-16 16:04:41 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-09-16 16:04:41 -0300 |
commit | e14310825437c5de93c07c570639d2a09fc4826b (patch) | |
tree | 6d63ed9d62bdb21fdbf41e8c5d30fcc08bb9326f /packages/taler-wallet-webextension/src/cta/Payment/test.ts | |
parent | 59d235e8d29159bc8caccf8bee6a2bca8b0b90dc (diff) | |
download | wallet-core-e14310825437c5de93c07c570639d2a09fc4826b.tar.xz |
pretty
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/Payment/test.ts')
-rw-r--r-- | packages/taler-wallet-webextension/src/cta/Payment/test.ts | 204 |
1 files changed, 110 insertions, 94 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/Payment/test.ts b/packages/taler-wallet-webextension/src/cta/Payment/test.ts index 91d2d825d..f4ce5afb3 100644 --- a/packages/taler-wallet-webextension/src/cta/Payment/test.ts +++ b/packages/taler-wallet-webextension/src/cta/Payment/test.ts @@ -75,7 +75,9 @@ describe("Payment CTA states", () => { talerPayUri: undefined, cancel: nullFunction, goToWalletManualWithdraw: nullFunction, - onSuccess: async () => { null; }, + onSuccess: async () => { + null; + }, }, { onUpdateNotification: nullFunction, @@ -111,19 +113,21 @@ describe("Payment CTA states", () => { talerPayUri: "taller://pay", cancel: nullFunction, goToWalletManualWithdraw: nullFunction, - onSuccess: async () => { null; }, + onSuccess: async () => { + null; + }, }, { onUpdateNotification: nullFunction, preparePay: async () => - ({ - amountRaw: "USD:10", - status: PreparePayResultType.InsufficientBalance, - } as Partial<PreparePayResult>), + ({ + amountRaw: "USD:10", + status: PreparePayResultType.InsufficientBalance, + } as Partial<PreparePayResult>), getBalance: async () => - ({ - balances: [], - } as Partial<BalancesResponse>), + ({ + balances: [], + } as Partial<BalancesResponse>), } as Partial<typeof wxApi> as any, ), ); @@ -154,23 +158,25 @@ describe("Payment CTA states", () => { talerPayUri: "taller://pay", cancel: nullFunction, goToWalletManualWithdraw: nullFunction, - onSuccess: async () => { null; }, + onSuccess: async () => { + null; + }, }, { onUpdateNotification: nullFunction, preparePay: async () => - ({ - amountRaw: "USD:10", - status: PreparePayResultType.InsufficientBalance, - } as Partial<PreparePayResult>), + ({ + amountRaw: "USD:10", + status: PreparePayResultType.InsufficientBalance, + } as Partial<PreparePayResult>), getBalance: async () => - ({ - balances: [ - { - available: "USD:5", - }, - ], - } as Partial<BalancesResponse>), + ({ + balances: [ + { + available: "USD:5", + }, + ], + } as Partial<BalancesResponse>), } as Partial<typeof wxApi> as any, ), ); @@ -201,24 +207,26 @@ describe("Payment CTA states", () => { talerPayUri: "taller://pay", cancel: nullFunction, goToWalletManualWithdraw: nullFunction, - onSuccess: async () => { null; }, + onSuccess: async () => { + null; + }, }, { onUpdateNotification: nullFunction, preparePay: async () => - ({ - amountRaw: "USD:10", - amountEffective: "USD:10", - status: PreparePayResultType.PaymentPossible, - } as Partial<PreparePayResult>), + ({ + amountRaw: "USD:10", + amountEffective: "USD:10", + status: PreparePayResultType.PaymentPossible, + } as Partial<PreparePayResult>), getBalance: async () => - ({ - balances: [ - { - available: "USD:15", - }, - ], - } as Partial<BalancesResponse>), + ({ + balances: [ + { + available: "USD:15", + }, + ], + } as Partial<BalancesResponse>), } as Partial<typeof wxApi> as any, ), ); @@ -251,24 +259,26 @@ describe("Payment CTA states", () => { talerPayUri: "taller://pay", cancel: nullFunction, goToWalletManualWithdraw: nullFunction, - onSuccess: async () => { null; }, + onSuccess: async () => { + null; + }, }, { onUpdateNotification: nullFunction, preparePay: async () => - ({ - amountRaw: "USD:9", - amountEffective: "USD:10", - status: PreparePayResultType.PaymentPossible, - } as Partial<PreparePayResult>), + ({ + amountRaw: "USD:9", + amountEffective: "USD:10", + status: PreparePayResultType.PaymentPossible, + } as Partial<PreparePayResult>), getBalance: async () => - ({ - balances: [ - { - available: "USD:15", - }, - ], - } as Partial<BalancesResponse>), + ({ + balances: [ + { + available: "USD:15", + }, + ], + } as Partial<BalancesResponse>), } as Partial<typeof wxApi> as any, ), ); @@ -301,29 +311,31 @@ describe("Payment CTA states", () => { talerPayUri: "taller://pay", cancel: nullFunction, goToWalletManualWithdraw: nullFunction, - onSuccess: async () => { null; }, + onSuccess: async () => { + null; + }, }, { onUpdateNotification: nullFunction, preparePay: async () => - ({ - amountRaw: "USD:9", - amountEffective: "USD:10", - status: PreparePayResultType.PaymentPossible, - } as Partial<PreparePayResult>), + ({ + amountRaw: "USD:9", + amountEffective: "USD:10", + status: PreparePayResultType.PaymentPossible, + } as Partial<PreparePayResult>), getBalance: async () => - ({ - balances: [ - { - available: "USD:15", - }, - ], - } as Partial<BalancesResponse>), + ({ + balances: [ + { + available: "USD:15", + }, + ], + } as Partial<BalancesResponse>), confirmPay: async () => - ({ - type: ConfirmPayResultType.Done, - contractTerms: {}, - } as Partial<ConfirmPayResult>), + ({ + type: ConfirmPayResultType.Done, + contractTerms: {}, + } as Partial<ConfirmPayResult>), } as Partial<typeof wxApi> as any, ), ); @@ -370,29 +382,31 @@ describe("Payment CTA states", () => { talerPayUri: "taller://pay", cancel: nullFunction, goToWalletManualWithdraw: nullFunction, - onSuccess: async () => { null; }, + onSuccess: async () => { + null; + }, }, { onUpdateNotification: nullFunction, preparePay: async () => - ({ - amountRaw: "USD:9", - amountEffective: "USD:10", - status: PreparePayResultType.PaymentPossible, - } as Partial<PreparePayResult>), + ({ + amountRaw: "USD:9", + amountEffective: "USD:10", + status: PreparePayResultType.PaymentPossible, + } as Partial<PreparePayResult>), getBalance: async () => - ({ - balances: [ - { - available: "USD:15", - }, - ], - } as Partial<BalancesResponse>), + ({ + balances: [ + { + available: "USD:15", + }, + ], + } as Partial<BalancesResponse>), confirmPay: async () => - ({ - type: ConfirmPayResultType.Pending, - lastError: { code: 1 }, - } as Partial<ConfirmPayResult>), + ({ + type: ConfirmPayResultType.Pending, + lastError: { code: 1 }, + } as Partial<ConfirmPayResult>), } as Partial<typeof wxApi> as any, ), ); @@ -454,24 +468,26 @@ describe("Payment CTA states", () => { talerPayUri: "taller://pay", cancel: nullFunction, goToWalletManualWithdraw: nullFunction, - onSuccess: async () => { null; }, + onSuccess: async () => { + null; + }, }, { onUpdateNotification: subscriptions.saveSubscription, preparePay: async () => - ({ - amountRaw: "USD:9", - amountEffective: "USD:10", - status: PreparePayResultType.PaymentPossible, - } as Partial<PreparePayResult>), + ({ + amountRaw: "USD:9", + amountEffective: "USD:10", + status: PreparePayResultType.PaymentPossible, + } as Partial<PreparePayResult>), getBalance: async () => - ({ - balances: [ - { - available: Amounts.stringify(availableBalance), - }, - ], - } as Partial<BalancesResponse>), + ({ + balances: [ + { + available: Amounts.stringify(availableBalance), + }, + ], + } as Partial<BalancesResponse>), } as Partial<typeof wxApi> as any, ), ); |