diff options
author | Florian Dold <florian@dold.me> | 2020-12-14 16:45:15 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2020-12-14 16:45:15 +0100 |
commit | f332d61fb68fbc394f31337ddeb7d1fc114772d0 (patch) | |
tree | eeb9e7dd527ab7efcaa7812f4440e8901185e9aa /packages/taler-integrationtests | |
parent | c4b44a51097e67a357b490adf407f1a6afb0d8ee (diff) | |
download | wallet-core-f332d61fb68fbc394f31337ddeb7d1fc114772d0.tar.xz |
formatting pass
Diffstat (limited to 'packages/taler-integrationtests')
13 files changed, 81 insertions, 58 deletions
diff --git a/packages/taler-integrationtests/src/denomStructures.ts b/packages/taler-integrationtests/src/denomStructures.ts index ee175a478..5ab9aca00 100644 --- a/packages/taler-integrationtests/src/denomStructures.ts +++ b/packages/taler-integrationtests/src/denomStructures.ts @@ -124,7 +124,6 @@ const coinCheapCommon = (curr: string) => ({ feeWithdraw: `${curr}:0.2`, }); - export function makeNoFeeCoinConfig(curr: string): CoinConfig[] { const cc: CoinConfig[] = []; diff --git a/packages/taler-integrationtests/src/harness.ts b/packages/taler-integrationtests/src/harness.ts index 2ac4c3d0e..1dd6c7c6f 100644 --- a/packages/taler-integrationtests/src/harness.ts +++ b/packages/taler-integrationtests/src/harness.ts @@ -908,9 +908,7 @@ export class ExchangeService implements ExchangeServiceInterface { addCoinConfigList(ccs: CoinConfig[]) { const config = Configuration.load(this.configFilename); - ccs.forEach((cc) => - setCoin(config, cc), - ); + ccs.forEach((cc) => setCoin(config, cc)); config.write(this.configFilename); } @@ -1545,8 +1543,9 @@ export class WalletCli { throw new OperationFailedError(resp.error); } - - async abortFailedPayWithRefund(req: AbortPayWithRefundRequest): Promise<void> { + async abortFailedPayWithRefund( + req: AbortPayWithRefundRequest, + ): Promise<void> { const resp = await this.apiRequest("abortFailedPayWithRefund", req); if (resp.type === "response") { return; diff --git a/packages/taler-integrationtests/src/merchantApiTypes.ts b/packages/taler-integrationtests/src/merchantApiTypes.ts index a7d0ea2cb..6782391a2 100644 --- a/packages/taler-integrationtests/src/merchantApiTypes.ts +++ b/packages/taler-integrationtests/src/merchantApiTypes.ts @@ -107,11 +107,13 @@ export const codecForCheckPaymentUnpaidResponse = (): Codec< .property("already_paid_order_id", codecOptional(codecForString())) .build("CheckPaymentPaidResponse"); -export const codecForCheckPaymentClaimedResponse = (): Codec<CheckPaymentClaimedResponse> => +export const codecForCheckPaymentClaimedResponse = (): Codec< + CheckPaymentClaimedResponse +> => buildCodecForObject<CheckPaymentClaimedResponse>() - .property("order_status", codecForConstString("claimed")) - .property("contract_terms", codecForContractTerms()) - .build("CheckPaymentClaimedResponse"); + .property("order_status", codecForConstString("claimed")) + .property("contract_terms", codecForContractTerms()) + .build("CheckPaymentClaimedResponse"); export const codecForMerchantOrderPrivateStatusResponse = (): Codec< MerchantOrderPrivateStatusResponse @@ -133,7 +135,7 @@ export interface CheckPaymentClaimedResponse { order_status: "claimed"; contract_terms: ContractTerms; -} +} export interface CheckPaymentPaidResponse { // did the customer pay for this contract @@ -179,7 +181,6 @@ export interface CheckPaymentPaidResponse { order_status_url: string; } - export interface CheckPaymentUnpaidResponse { order_status: "unpaid"; @@ -275,7 +276,6 @@ export interface ReserveStatusEntry { active: boolean; } - export interface TipCreateConfirmation { // Unique tip identifier for the tip that was created. tip_id: string; diff --git a/packages/taler-integrationtests/src/test-bank-api.ts b/packages/taler-integrationtests/src/test-bank-api.ts index b6dd3f1b9..08991e279 100644 --- a/packages/taler-integrationtests/src/test-bank-api.ts +++ b/packages/taler-integrationtests/src/test-bank-api.ts @@ -116,7 +116,9 @@ runTest(async (t: GlobalTestState) => { // Check that we got the sign-up bonus. t.assertAmountEquals(balResp.balance.amount, "TESTKUDOS:100"); - t.assertTrue(balResp.balance.credit_debit_indicator === CreditDebitIndicator.Credit); + t.assertTrue( + balResp.balance.credit_debit_indicator === CreditDebitIndicator.Credit, + ); const res = createEddsaKeyPair(); @@ -129,5 +131,7 @@ runTest(async (t: GlobalTestState) => { balResp = await BankAccessApi.getAccountBalance(bank, bankUser); t.assertAmountEquals(balResp.balance.amount, "TESTKUDOS:15"); - t.assertTrue(balResp.balance.credit_debit_indicator === CreditDebitIndicator.Debit); + t.assertTrue( + balResp.balance.credit_debit_indicator === CreditDebitIndicator.Debit, + ); }); diff --git a/packages/taler-integrationtests/src/test-claim-loop.ts b/packages/taler-integrationtests/src/test-claim-loop.ts index da8f7d45d..8c4df8740 100644 --- a/packages/taler-integrationtests/src/test-claim-loop.ts +++ b/packages/taler-integrationtests/src/test-claim-loop.ts @@ -24,11 +24,11 @@ import { WalletCli, } from "./harness"; import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers"; -import { URL } from "url" +import { URL } from "url"; /** * Run test for the merchant's order lifecycle. - * + * * FIXME: Is this test still necessary? We initially wrote if to confirm/document * assumptions about how the merchant should work. */ @@ -50,27 +50,33 @@ runTest(async (t: GlobalTestState) => { summary: "Buy me!", amount: "TESTKUDOS:5", fulfillment_url: "taler://fulfillment-success/thx", - } + }, }); - + // Query private order status before claiming it. - let orderStatusBefore = await MerchantPrivateApi.queryPrivateOrderStatus(merchant, { - orderId: orderResp.order_id, - }); + let orderStatusBefore = await MerchantPrivateApi.queryPrivateOrderStatus( + merchant, + { + orderId: orderResp.order_id, + }, + ); t.assertTrue(orderStatusBefore.order_status === "unpaid"); let statusUrlBefore = new URL(orderStatusBefore.order_status_url); // Make wallet claim the unpaid order. - t.assertTrue(orderStatusBefore.order_status === "unpaid"); + t.assertTrue(orderStatusBefore.order_status === "unpaid"); const talerPayUri = orderStatusBefore.taler_pay_uri; const y = await wallet.preparePay({ - talerPayUri + talerPayUri, }); // Query private order status after claiming it. - let orderStatusAfter = await MerchantPrivateApi.queryPrivateOrderStatus(merchant, { - orderId: orderResp.order_id, - }); + let orderStatusAfter = await MerchantPrivateApi.queryPrivateOrderStatus( + merchant, + { + orderId: orderResp.order_id, + }, + ); t.assertTrue(orderStatusAfter.order_status === "claimed"); await t.shutdown(); diff --git a/packages/taler-integrationtests/src/test-fee-regression.ts b/packages/taler-integrationtests/src/test-fee-regression.ts index 304744697..7b3193df2 100644 --- a/packages/taler-integrationtests/src/test-fee-regression.ts +++ b/packages/taler-integrationtests/src/test-fee-regression.ts @@ -17,15 +17,22 @@ /** * Imports. */ -import { defaultCoinConfig } from './denomStructures'; -import { runTest, GlobalTestState, BankService, ExchangeService, MerchantService, setupDb, WalletCli } from "./harness"; +import { defaultCoinConfig } from "./denomStructures"; +import { + runTest, + GlobalTestState, + BankService, + ExchangeService, + MerchantService, + setupDb, + WalletCli, +} from "./harness"; import { withdrawViaBank, makeTestPayment, SimpleTestEnvironment, } from "./helpers"; - /** * Run a test case with a simple TESTKUDOS Taler environment, consisting * of one exchange, one bank and one merchant. @@ -83,42 +90,42 @@ export async function createMyTestkudosEnvironment( { ...coinCommon, name: "c1", - value: "TESTKUDOS:1.28" + value: "TESTKUDOS:1.28", }, { ...coinCommon, name: "c2", - value: "TESTKUDOS:0.64" + value: "TESTKUDOS:0.64", }, { ...coinCommon, name: "c3", - value: "TESTKUDOS:0.32" + value: "TESTKUDOS:0.32", }, { ...coinCommon, name: "c4", - value: "TESTKUDOS:0.16" + value: "TESTKUDOS:0.16", }, { ...coinCommon, name: "c5", - value: "TESTKUDOS:0.08" + value: "TESTKUDOS:0.08", }, { ...coinCommon, name: "c5", - value: "TESTKUDOS:0.04" + value: "TESTKUDOS:0.04", }, { ...coinCommon, name: "c6", - value: "TESTKUDOS:0.02" + value: "TESTKUDOS:0.02", }, { ...coinCommon, name: "c7", - value: "TESTKUDOS:0.01" + value: "TESTKUDOS:0.01", }, ]); @@ -171,7 +178,12 @@ runTest(async (t: GlobalTestState) => { // Withdraw digital cash into the wallet. - await withdrawViaBank(t, { wallet, bank, exchange, amount: "TESTKUDOS:1.92" }); + await withdrawViaBank(t, { + wallet, + bank, + exchange, + amount: "TESTKUDOS:1.92", + }); const coins = await wallet.dumpCoins(); diff --git a/packages/taler-integrationtests/src/test-pay-abort.ts b/packages/taler-integrationtests/src/test-pay-abort.ts index 1d01c6f75..566500091 100644 --- a/packages/taler-integrationtests/src/test-pay-abort.ts +++ b/packages/taler-integrationtests/src/test-pay-abort.ts @@ -39,11 +39,7 @@ import { FaultInjectionRequestContext, FaultInjectionResponseContext, } from "./faultInjection"; -import { - PreparePayResultType, - URL, - TalerErrorCode, -} from "taler-wallet-core"; +import { PreparePayResultType, URL, TalerErrorCode } from "taler-wallet-core"; import { defaultCoinConfig } from "./denomStructures"; import { withdrawViaBank, makeTestPayment } from "./helpers"; diff --git a/packages/taler-integrationtests/src/test-pay-paid.ts b/packages/taler-integrationtests/src/test-pay-paid.ts index b5dd6bd79..40f7d014f 100644 --- a/packages/taler-integrationtests/src/test-pay-paid.ts +++ b/packages/taler-integrationtests/src/test-pay-paid.ts @@ -34,7 +34,7 @@ import { FaultInjectionRequestContext } from "./faultInjection"; /** * Run test for the wallets repurchase detection mechanism * based on the fulfillment URL. - * + * * FIXME: This test is now almost the same as test-paywall-flow, * since we can't initiate payment via a "claimed" private order status * response. @@ -150,7 +150,10 @@ runTest(async (t: GlobalTestState) => { sessionId: "mysession-two", }); - console.log("order status under mysession-two:", JSON.stringify(orderStatus, undefined, 2)); + console.log( + "order status under mysession-two:", + JSON.stringify(orderStatus, undefined, 2), + ); // Should be claimed (not paid!) because of a new session ID t.assertTrue(orderStatus.order_status === "claimed"); @@ -169,7 +172,6 @@ runTest(async (t: GlobalTestState) => { }, }); - let orderRespTwo = await MerchantPrivateApi.createOrder(merchant, "default", { order: { summary: "Buy me!", @@ -178,10 +180,13 @@ runTest(async (t: GlobalTestState) => { }, }); - let orderStatusTwo = await MerchantPrivateApi.queryPrivateOrderStatus(merchant, { - orderId: orderRespTwo.order_id, - sessionId: "mysession-two", - }); + let orderStatusTwo = await MerchantPrivateApi.queryPrivateOrderStatus( + merchant, + { + orderId: orderRespTwo.order_id, + sessionId: "mysession-two", + }, + ); t.assertTrue(orderStatusTwo.order_status === "unpaid"); diff --git a/packages/taler-integrationtests/src/test-payment-multiple.ts b/packages/taler-integrationtests/src/test-payment-multiple.ts index 8dad515c6..c6a0868af 100644 --- a/packages/taler-integrationtests/src/test-payment-multiple.ts +++ b/packages/taler-integrationtests/src/test-payment-multiple.ts @@ -25,7 +25,6 @@ import { ExchangeService, MerchantService, WalletCli, - MerchantPrivateApi, } from "./harness"; import { withdrawViaBank } from "./helpers"; diff --git a/packages/taler-integrationtests/src/test-payment-transient.ts b/packages/taler-integrationtests/src/test-payment-transient.ts index e79913298..dc7ebbb1d 100644 --- a/packages/taler-integrationtests/src/test-payment-transient.ts +++ b/packages/taler-integrationtests/src/test-payment-transient.ts @@ -32,7 +32,10 @@ import { TalerErrorCode, } from "taler-wallet-core"; import axios from "axios"; -import { FaultInjectionRequestContext, FaultInjectionResponseContext } from "./faultInjection"; +import { + FaultInjectionRequestContext, + FaultInjectionResponseContext, +} from "./faultInjection"; /** * Run test for a payment where the merchant has a transient @@ -134,7 +137,7 @@ runTest(async (t: GlobalTestState) => { }; ctx.responseBody = Buffer.from(JSON.stringify(err)); ctx.statusCode = 500; - } + }, }); const confirmPayResp = await wallet.confirmPay({ diff --git a/packages/taler-integrationtests/src/test-refund-auto.ts b/packages/taler-integrationtests/src/test-refund-auto.ts index 91051b22d..1a7055fd4 100644 --- a/packages/taler-integrationtests/src/test-refund-auto.ts +++ b/packages/taler-integrationtests/src/test-refund-auto.ts @@ -48,7 +48,7 @@ runTest(async (t: GlobalTestState) => { d_ms: 3000, }, }, - refund_delay: durationFromSpec({ minutes: 5}), + refund_delay: durationFromSpec({ minutes: 5 }), }); let orderStatus = await MerchantPrivateApi.queryPrivateOrderStatus(merchant, { diff --git a/packages/taler-integrationtests/src/test-refund-incremental.ts b/packages/taler-integrationtests/src/test-refund-incremental.ts index d83fda470..7ad406daf 100644 --- a/packages/taler-integrationtests/src/test-refund-incremental.ts +++ b/packages/taler-integrationtests/src/test-refund-incremental.ts @@ -51,7 +51,7 @@ runTest(async (t: GlobalTestState) => { amount: "TESTKUDOS:10", fulfillment_url: "taler://fulfillment-success/thx", }, - refund_delay: durationFromSpec({ minutes: 5}), + refund_delay: durationFromSpec({ minutes: 5 }), }); let orderStatus = await MerchantPrivateApi.queryPrivateOrderStatus(merchant, { diff --git a/packages/taler-integrationtests/src/test-refund.ts b/packages/taler-integrationtests/src/test-refund.ts index 40fadd5de..908136518 100644 --- a/packages/taler-integrationtests/src/test-refund.ts +++ b/packages/taler-integrationtests/src/test-refund.ts @@ -17,7 +17,7 @@ /** * Imports. */ -import { durationFromSpec } from 'taler-wallet-core'; +import { durationFromSpec } from "taler-wallet-core"; import { runTest, GlobalTestState, MerchantPrivateApi } from "./harness"; import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers"; @@ -46,7 +46,7 @@ runTest(async (t: GlobalTestState) => { amount: "TESTKUDOS:5", fulfillment_url: "taler://fulfillment-success/thx", }, - refund_delay: durationFromSpec({ minutes: 5}), + refund_delay: durationFromSpec({ minutes: 5 }), }); let orderStatus = await MerchantPrivateApi.queryPrivateOrderStatus(merchant, { |