diff options
author | Florian Dold <florian@dold.me> | 2021-08-06 18:51:37 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-08-06 18:51:37 +0200 |
commit | 20ffa834d8e1b135b308e27d2b655e6868ce1872 (patch) | |
tree | 6a5833467167e600267858203751b1ff9189a512 /packages | |
parent | 5e69745072b6040fa186422c3ab6c303dabbae21 (diff) |
tag test properly
Diffstat (limited to 'packages')
4 files changed, 42 insertions, 22 deletions
diff --git a/packages/taler-wallet-cli/src/integrationtests/libeufin.ts b/packages/taler-wallet-cli/src/integrationtests/libeufin.ts index a30ce97ab..5e524af1e 100644 --- a/packages/taler-wallet-cli/src/integrationtests/libeufin.ts +++ b/packages/taler-wallet-cli/src/integrationtests/libeufin.ts @@ -168,9 +168,9 @@ export interface LibeufinSandboxAddIncomingRequest { creditorIban: string; creditorBic: string; creditorName: string; - debitorIban: string; - debitorBic: string; - debitorName: string; + debtorIban: string; + debtorBic: string; + debtorName: string; subject: string; amount: string; currency: string; @@ -332,7 +332,6 @@ export interface SimulateIncomingTransactionRequest { * Decimal amount without currency. */ amount: string; - currency: string; } /** @@ -798,9 +797,9 @@ export namespace LibeufinSandboxApi { creditorIban: creditorBundle.ebicsBankAccount.iban, creditorBic: creditorBundle.ebicsBankAccount.bic, creditorName: creditorBundle.ebicsBankAccount.name, - debitorIban: debitorBundle.ebicsBankAccount.iban, - debitorBic: debitorBundle.ebicsBankAccount.bic, - debitorName: debitorBundle.ebicsBankAccount.name, + debtorIban: debitorBundle.ebicsBankAccount.iban, + debtorBic: debitorBundle.ebicsBankAccount.bic, + debtorName: debitorBundle.ebicsBankAccount.name, subject: subject, amount: amount, currency: currency, diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankaccount.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankaccount.ts index 3c3912254..2fbc952e7 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankaccount.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankaccount.ts @@ -93,9 +93,9 @@ export async function runLibeufinApiBankaccountTest(t: GlobalTestState) { creditorIban: "DE71500105179674997361", creditorBic: "BELADEBEXXX", creditorName: "mock", - debitorIban: "DE84500105176881385584", - debitorBic: "BELADEBEXXX", - debitorName: "mock2", + debtorIban: "DE84500105176881385584", + debtorBic: "BELADEBEXXX", + debtorName: "mock2", subject: "mock subject", currency: "EUR", amount: "1", diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-basic.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-basic.ts index 34525844f..48096bcb7 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-basic.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-basic.ts @@ -257,7 +257,6 @@ export async function runLibeufinBasicTest(t: GlobalTestState) { "exchangeacct", { amount: "15.00", - currency: "EUR", debtorBic: customerBic, debtorIban: customerIban, debtorName: "Jane Customer", diff --git a/packages/taler-wallet-cli/src/integrationtests/test-merchant-longpolling.ts b/packages/taler-wallet-cli/src/integrationtests/test-merchant-longpolling.ts index d91787637..6516327c2 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-merchant-longpolling.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-merchant-longpolling.ts @@ -23,7 +23,7 @@ import { PreparePayResultType, codecForMerchantOrderStatusUnpaid, ConfirmPayResultType, - URL + URL, } from "@gnu-taler/taler-util"; import axios from "axios"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; @@ -60,10 +60,9 @@ export async function runMerchantLongpollingTest(t: GlobalTestState) { amount: "TESTKUDOS:5", fulfillment_url: "https://example.com/article42", }, + create_token: false, }); - const firstOrderId = orderResp.order_id; - let orderStatus = await MerchantPrivateApi.queryPrivateOrderStatus(merchant, { orderId: orderResp.order_id, sessionId: "mysession-one", @@ -74,16 +73,31 @@ export async function runMerchantLongpollingTest(t: GlobalTestState) { t.assertTrue(orderStatus.already_paid_order_id === undefined); let publicOrderStatusUrl = new URL(orderStatus.order_status_url); - // Wait for half a second seconds! + // First, request order status without longpolling + { + console.log("requesting", publicOrderStatusUrl.href); + let publicOrderStatusResp = await axios.get(publicOrderStatusUrl.href, { + validateStatus: () => true, + }); + + if (publicOrderStatusResp.status != 402) { + throw Error( + `expected status 402 (before claiming, no long polling), but got ${publicOrderStatusResp.status}`, + ); + } + } + + // Now do long-polling for half a second! publicOrderStatusUrl.searchParams.set("timeout_ms", "500"); + console.log("requesting", publicOrderStatusUrl.href); let publicOrderStatusResp = await axios.get(publicOrderStatusUrl.href, { validateStatus: () => true, }); if (publicOrderStatusResp.status != 402) { throw Error( - `expected status 402 (before claiming), but got ${publicOrderStatusResp.status}`, + `expected status 402 (before claiming, with long-polling), but got ${publicOrderStatusResp.status}`, ); } @@ -99,12 +113,6 @@ export async function runMerchantLongpollingTest(t: GlobalTestState) { * ========================================================================= */ - publicOrderStatusUrl.searchParams.set("timeout_ms", "5000"); - - let publicOrderStatusPromise = axios.get(publicOrderStatusUrl.href, { - validateStatus: () => true, - }); - let preparePayResp = await wallet.client.call( WalletApiOperation.PreparePayForUri, { @@ -114,6 +122,18 @@ export async function runMerchantLongpollingTest(t: GlobalTestState) { t.assertTrue(preparePayResp.status === PreparePayResultType.PaymentPossible); + publicOrderStatusUrl.searchParams.set("timeout_ms", "5000"); + publicOrderStatusUrl.searchParams.set( + "h_contract", + preparePayResp.contractTermsHash, + ); + + let publicOrderStatusPromise = axios.get(publicOrderStatusUrl.href, { + validateStatus: () => true, + }); + + t.assertTrue(preparePayResp.status === PreparePayResultType.PaymentPossible); + const proposalId = preparePayResp.proposalId; publicOrderStatusResp = await publicOrderStatusPromise; @@ -137,3 +157,5 @@ export async function runMerchantLongpollingTest(t: GlobalTestState) { t.assertTrue(confirmPayRes.type === ConfirmPayResultType.Done); } + +runMerchantLongpollingTest.suites = ["merchant"]; |