diff options
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, ), ); |