diff options
Diffstat (limited to 'packages/taler-harness/src/integrationtests')
30 files changed, 180 insertions, 231 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-libeufin-api-bankaccount.ts b/packages/taler-harness/src/integrationtests/test-libeufin-api-bankaccount.ts index f36168301..e5e3dfe64 100644 --- a/packages/taler-harness/src/integrationtests/test-libeufin-api-bankaccount.ts +++ b/packages/taler-harness/src/integrationtests/test-libeufin-api-bankaccount.ts @@ -101,7 +101,7 @@ export async function runLibeufinApiBankaccountTest(t: GlobalTestState) { nexus, "local-mock", ); - let el = findNexusPayment("mock subject", transactions.data); + let el = findNexusPayment("mock subject", transactions); t.assertTrue(el instanceof Object); } diff --git a/packages/taler-harness/src/integrationtests/test-libeufin-api-bankconnection.ts b/packages/taler-harness/src/integrationtests/test-libeufin-api-bankconnection.ts index 912b7b2ac..243500dc9 100644 --- a/packages/taler-harness/src/integrationtests/test-libeufin-api-bankconnection.ts +++ b/packages/taler-harness/src/integrationtests/test-libeufin-api-bankconnection.ts @@ -45,12 +45,12 @@ export async function runLibeufinApiBankconnectionTest(t: GlobalTestState) { }); let connections = await LibeufinNexusApi.getAllConnections(nexus); - t.assertTrue(connections.data["bankConnections"].length == 1); + t.assertTrue(connections.bankConnections.length == 1); await LibeufinNexusApi.deleteBankConnection(nexus, { bankConnectionId: "bankconnection-api-test-connection", }); connections = await LibeufinNexusApi.getAllConnections(nexus); - t.assertTrue(connections.data["bankConnections"].length == 0); + t.assertTrue(connections.bankConnections.length == 0); } runLibeufinApiBankconnectionTest.suites = ["libeufin"]; diff --git a/packages/taler-harness/src/integrationtests/test-libeufin-api-facade-bad-request.ts b/packages/taler-harness/src/integrationtests/test-libeufin-api-facade-bad-request.ts index a1da9e0da..27cc81588 100644 --- a/packages/taler-harness/src/integrationtests/test-libeufin-api-facade-bad-request.ts +++ b/packages/taler-harness/src/integrationtests/test-libeufin-api-facade-bad-request.ts @@ -18,15 +18,16 @@ * Imports. */ import { URL } from "@gnu-taler/taler-util"; -import axiosImp from "axios"; -import { GlobalTestState } from "../harness/harness.js"; +import { GlobalTestState, harnessHttpLib } from "../harness/harness.js"; import { launchLibeufinServices, NexusUserBundle, SandboxUserBundle, } from "../harness/libeufin.js"; - -const axios = axiosImp.default; +import { + createPlatformHttpLib, + makeBasicAuthHeader, +} from "@gnu-taler/taler-util/http"; export async function runLibeufinApiFacadeBadRequestTest(t: GlobalTestState) { /** @@ -50,21 +51,17 @@ export async function runLibeufinApiFacadeBadRequestTest(t: GlobalTestState) { console.log("malformed facade"); const baseUrl = libeufinServices.libeufinNexus.baseUrl; let url = new URL("facades", baseUrl); - let resp = await axios.post( - url.href, - { + let resp = await harnessHttpLib.fetch(url.href, { + method: "POST", + body: { name: "malformed-facade", type: "taler-wire-gateway", config: {}, // malformation here. }, - { - auth: { - username: "admin", - password: "test", - }, - validateStatus: () => true, + headers: { + Authorization: makeBasicAuthHeader("admin", "test"), }, - ); + }); t.assertTrue(resp.status == 400); } diff --git a/packages/taler-harness/src/integrationtests/test-libeufin-api-facade.ts b/packages/taler-harness/src/integrationtests/test-libeufin-api-facade.ts index 946c565d4..a819dd481 100644 --- a/packages/taler-harness/src/integrationtests/test-libeufin-api-facade.ts +++ b/packages/taler-harness/src/integrationtests/test-libeufin-api-facade.ts @@ -51,20 +51,20 @@ export async function runLibeufinApiFacadeTest(t: GlobalTestState) { libeufinServices.libeufinNexus, ); // check that original facade shows up. - t.assertTrue(resp.data["facades"][0]["name"] == user01nexus.twgReq["name"]); + t.assertTrue(resp.facades[0].name == user01nexus.twgReq["name"]); - const twgBaseUrl: string = resp.data["facades"][0]["baseUrl"]; + const twgBaseUrl: string = resp.facades[0]["baseUrl"]; t.assertTrue(typeof twgBaseUrl === "string"); t.assertTrue(twgBaseUrl.startsWith("http://")); t.assertTrue(twgBaseUrl.endsWith("/")); // delete it. - resp = await LibeufinNexusApi.deleteFacade( + await LibeufinNexusApi.deleteFacade( libeufinServices.libeufinNexus, user01nexus.twgReq["name"], ); - // check that no facades show up. - t.assertTrue(!resp.data.hasOwnProperty("facades")); + resp = await LibeufinNexusApi.getAllFacades(libeufinServices.libeufinNexus); + t.assertTrue(!resp.hasOwnProperty("facades")); } runLibeufinApiFacadeTest.suites = ["libeufin"]; diff --git a/packages/taler-harness/src/integrationtests/test-libeufin-api-permissions.ts b/packages/taler-harness/src/integrationtests/test-libeufin-api-permissions.ts index f8f2d7d80..56443c20a 100644 --- a/packages/taler-harness/src/integrationtests/test-libeufin-api-permissions.ts +++ b/packages/taler-harness/src/integrationtests/test-libeufin-api-permissions.ts @@ -46,7 +46,8 @@ export async function runLibeufinApiPermissionsTest(t: GlobalTestState) { user01nexus.twgTransferPermission, ); let transferPermission = await LibeufinNexusApi.getAllPermissions(nexus); - let element = transferPermission.data["permissions"].pop(); + let element = transferPermission["permissions"].pop(); + t.assertTrue(!!element); t.assertTrue( element["permissionName"] == "facade.talerwiregateway.transfer" && element["subjectId"] == "username-01", @@ -58,7 +59,7 @@ export async function runLibeufinApiPermissionsTest(t: GlobalTestState) { await LibeufinNexusApi.postPermission(nexus, denyTransfer); transferPermission = await LibeufinNexusApi.getAllPermissions(nexus); - t.assertTrue(transferPermission.data["permissions"].length == 0); + t.assertTrue(transferPermission["permissions"].length == 0); } runLibeufinApiPermissionsTest.suites = ["libeufin"]; diff --git a/packages/taler-harness/src/integrationtests/test-libeufin-api-sandbox-transactions.ts b/packages/taler-harness/src/integrationtests/test-libeufin-api-sandbox-transactions.ts index f1ff69a6d..6cfc55aa6 100644 --- a/packages/taler-harness/src/integrationtests/test-libeufin-api-sandbox-transactions.ts +++ b/packages/taler-harness/src/integrationtests/test-libeufin-api-sandbox-transactions.ts @@ -64,6 +64,6 @@ export async function runLibeufinApiSandboxTransactionsTest( sandbox, "mock-account", ); - t.assertAmountEquals(ret.data.balance, "EUR:2.1"); + t.assertAmountEquals(ret.balance, "EUR:2.1"); } runLibeufinApiSandboxTransactionsTest.suites = ["libeufin"]; diff --git a/packages/taler-harness/src/integrationtests/test-libeufin-api-scheduling.ts b/packages/taler-harness/src/integrationtests/test-libeufin-api-scheduling.ts index 95f4bfaa0..15ed2ab78 100644 --- a/packages/taler-harness/src/integrationtests/test-libeufin-api-scheduling.ts +++ b/packages/taler-harness/src/integrationtests/test-libeufin-api-scheduling.ts @@ -54,19 +54,19 @@ export async function runLibeufinApiSchedulingTest(t: GlobalTestState) { rangeType: "all", }, }); - let resp = await LibeufinNexusApi.getTasks( + let resp = await LibeufinNexusApi.getTask( nexus, user01nexus.localAccountName, "test-task", ); - t.assertTrue(resp.data["taskName"] == "test-task"); + t.assertTrue(resp.taskName == "test-task"); await LibeufinNexusApi.deleteTask( nexus, user01nexus.localAccountName, "test-task", ); try { - await LibeufinNexusApi.getTasks( + await LibeufinNexusApi.getTask( nexus, user01nexus.localAccountName, "test-task", @@ -82,19 +82,19 @@ export async function runLibeufinApiSchedulingTest(t: GlobalTestState) { type: "submit", params: {}, }); - resp = await LibeufinNexusApi.getTasks( + resp = await LibeufinNexusApi.getTask( nexus, user01nexus.localAccountName, "test-task", ); - t.assertTrue(resp.data["taskName"] == "test-task"); + t.assertTrue(resp.taskName == "test-task"); await LibeufinNexusApi.deleteTask( nexus, user01nexus.localAccountName, "test-task", ); try { - await LibeufinNexusApi.getTasks( + await LibeufinNexusApi.getTask( nexus, user01nexus.localAccountName, "test-task", diff --git a/packages/taler-harness/src/integrationtests/test-libeufin-api-users.ts b/packages/taler-harness/src/integrationtests/test-libeufin-api-users.ts index bc3103c7e..662b22bbe 100644 --- a/packages/taler-harness/src/integrationtests/test-libeufin-api-users.ts +++ b/packages/taler-harness/src/integrationtests/test-libeufin-api-users.ts @@ -56,8 +56,8 @@ export async function runLibeufinApiUsersTest(t: GlobalTestState) { password: "got-changed", }, }); - console.log(resp.data); - t.assertTrue(resp.data["username"] == "one" && !resp.data["superuser"]); + console.log(resp); + t.assertTrue(resp["username"] == "one" && !resp["superuser"]); } runLibeufinApiUsersTest.suites = ["libeufin"]; diff --git a/packages/taler-harness/src/integrationtests/test-libeufin-c5x.ts b/packages/taler-harness/src/integrationtests/test-libeufin-c5x.ts index c6dfca99b..5097bc4d3 100644 --- a/packages/taler-harness/src/integrationtests/test-libeufin-c5x.ts +++ b/packages/taler-harness/src/integrationtests/test-libeufin-c5x.ts @@ -79,7 +79,7 @@ export async function runLibeufinC5xTest(t: GlobalTestState) { libeufinServices.libeufinNexus, user01nexus.localAccountName, ); - t.assertTrue(nexusTxs.data["transactions"].length == 0); + t.assertTrue(nexusTxs["transactions"].length == 0); // Addressing one payment to user 01 await libeufinServices.libeufinSandbox.makeTransaction( @@ -95,8 +95,8 @@ export async function runLibeufinC5xTest(t: GlobalTestState) { "all", // range "report", // C52 ); - t.assertTrue(expectOne.data.newTransactions == 1); - t.assertTrue(expectOne.data.downloadedTransactions == 1); + t.assertTrue(expectOne.newTransactions == 1); + t.assertTrue(expectOne.downloadedTransactions == 1); /* Expect zero payments being downloaded because the * previous request consumed already the one pending @@ -108,8 +108,8 @@ export async function runLibeufinC5xTest(t: GlobalTestState) { "all", // range "report", // C52 ); - t.assertTrue(expectZero.data.newTransactions == 0); - t.assertTrue(expectZero.data.downloadedTransactions == 0); + t.assertTrue(expectZero.newTransactions == 0); + t.assertTrue(expectZero.downloadedTransactions == 0); /** * A statement should still account zero payments because @@ -121,8 +121,8 @@ export async function runLibeufinC5xTest(t: GlobalTestState) { "all", // range "statement", // C53 ); - t.assertTrue(expectZero.data.newTransactions == 0); - t.assertTrue(expectZero.data.downloadedTransactions == 0); + t.assertTrue(expectZero.newTransactions == 0); + t.assertTrue(expectZero.downloadedTransactions == 0); /** * Ticking now. That books any pending transaction. @@ -141,7 +141,7 @@ export async function runLibeufinC5xTest(t: GlobalTestState) { "all", // range "statement", // C53 ); - t.assertTrue(expectOne.data.downloadedTransactions == 1); - t.assertTrue(expectOne.data.newTransactions == 0); + t.assertTrue(expectOne.downloadedTransactions == 1); + t.assertTrue(expectOne.newTransactions == 0); } runLibeufinC5xTest.suites = ["libeufin"]; diff --git a/packages/taler-harness/src/integrationtests/test-libeufin-facade-anastasis.ts b/packages/taler-harness/src/integrationtests/test-libeufin-facade-anastasis.ts index 10c73fed5..0efd55f44 100644 --- a/packages/taler-harness/src/integrationtests/test-libeufin-facade-anastasis.ts +++ b/packages/taler-harness/src/integrationtests/test-libeufin-facade-anastasis.ts @@ -53,9 +53,9 @@ export async function runLibeufinAnastasisFacadeTest(t: GlobalTestState) { ); // check that original facade shows up. t.assertTrue( - resp.data["facades"][0]["name"] == user01nexus.anastasisReq["name"], + resp["facades"][0]["name"] == user01nexus.anastasisReq["name"], ); - const anastasisBaseUrl: string = resp.data["facades"][0]["baseUrl"]; +const anastasisBaseUrl: string = resp["facades"][0]["baseUrl"]; t.assertTrue(typeof anastasisBaseUrl === "string"); t.assertTrue(anastasisBaseUrl.startsWith("http://")); t.assertTrue(anastasisBaseUrl.endsWith("/")); diff --git a/packages/taler-harness/src/integrationtests/test-libeufin-refund.ts b/packages/taler-harness/src/integrationtests/test-libeufin-refund.ts index 9d90121a0..d37363bab 100644 --- a/packages/taler-harness/src/integrationtests/test-libeufin-refund.ts +++ b/packages/taler-harness/src/integrationtests/test-libeufin-refund.ts @@ -77,7 +77,7 @@ export async function runLibeufinRefundTest(t: GlobalTestState) { libeufinServices.libeufinNexus, user01nexus.localAccountName, ); - t.assertTrue(nexusTxs.data["transactions"].length == 1); + t.assertTrue(nexusTxs["transactions"].length == 1); // Submit the reimbursement await LibeufinNexusApi.submitInitiatedPayment( diff --git a/packages/taler-harness/src/integrationtests/test-libeufin-sandbox-wire-transfer-cli.ts b/packages/taler-harness/src/integrationtests/test-libeufin-sandbox-wire-transfer-cli.ts index e6b074d3f..be467e2f1 100644 --- a/packages/taler-harness/src/integrationtests/test-libeufin-sandbox-wire-transfer-cli.ts +++ b/packages/taler-harness/src/integrationtests/test-libeufin-sandbox-wire-transfer-cli.ts @@ -79,7 +79,7 @@ export async function runLibeufinSandboxWireTransferCliTest( sandbox, "mock-account-2", ); - console.log(ret.data.balance); - t.assertTrue(ret.data.balance == "EUR:1.89"); + console.log(ret.balance); + t.assertTrue(ret.balance == "EUR:1.89"); } runLibeufinSandboxWireTransferCliTest.suites = ["libeufin"]; diff --git a/packages/taler-harness/src/integrationtests/test-merchant-exchange-confusion.ts b/packages/taler-harness/src/integrationtests/test-merchant-exchange-confusion.ts index 2fccd0b97..e18cd7a0f 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-exchange-confusion.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-exchange-confusion.ts @@ -23,8 +23,6 @@ import { PreparePayResultType, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import axiosImp from "axios"; -const axios = axiosImp.default; import { URL } from "url"; import { defaultCoinConfig } from "../harness/denomStructures.js"; import { @@ -36,6 +34,7 @@ import { ExchangeService, getPayto, GlobalTestState, + harnessHttpLib, MerchantPrivateApi, MerchantService, setupDb, @@ -45,6 +44,7 @@ import { FaultyMerchantTestEnvironment, withdrawViaBank, } from "../harness/helpers.js"; +import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; /** * Run a test case with a simple TESTKUDOS Taler environment, consisting @@ -186,9 +186,7 @@ export async function runMerchantExchangeConfusionTest(t: GlobalTestState) { t.assertTrue(orderStatus.already_paid_order_id === undefined); let publicOrderStatusUrl = orderStatus.order_status_url; - let publicOrderStatusResp = await axios.get(publicOrderStatusUrl, { - validateStatus: () => true, - }); + let publicOrderStatusResp = await harnessHttpLib.fetch(publicOrderStatusUrl); if (publicOrderStatusResp.status != 402) { throw Error( @@ -197,7 +195,7 @@ export async function runMerchantExchangeConfusionTest(t: GlobalTestState) { } let pubUnpaidStatus = codecForMerchantOrderStatusUnpaid().decode( - publicOrderStatusResp.data, + await publicOrderStatusResp.json(), ); console.log(pubUnpaidStatus); @@ -221,9 +219,7 @@ export async function runMerchantExchangeConfusionTest(t: GlobalTestState) { console.log("requesting", orderUrlWithHash.href); - publicOrderStatusResp = await axios.get(orderUrlWithHash.href, { - validateStatus: () => true, - }); + publicOrderStatusResp = await harnessHttpLib.fetch(orderUrlWithHash.href); if (publicOrderStatusResp.status != 402) { throw Error( @@ -232,7 +228,7 @@ export async function runMerchantExchangeConfusionTest(t: GlobalTestState) { } pubUnpaidStatus = codecForMerchantOrderStatusUnpaid().decode( - publicOrderStatusResp.data, + await publicOrderStatusResp.json(), ); const confirmPayRes = await wallet.client.call( diff --git a/packages/taler-harness/src/integrationtests/test-merchant-instances-delete.ts b/packages/taler-harness/src/integrationtests/test-merchant-instances-delete.ts index 09231cdd8..e6e5bff76 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-instances-delete.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-instances-delete.ts @@ -17,9 +17,7 @@ /** * Imports. */ -import { URL } from "@gnu-taler/taler-util"; -import axiosImp from "axios"; -const axios = axiosImp.default; +import { TalerError, URL } from "@gnu-taler/taler-util"; import { ExchangeService, GlobalTestState, @@ -27,7 +25,9 @@ import { MerchantService, setupDb, getPayto, + harnessHttpLib, } from "../harness/harness.js"; +import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; /** * Test instance deletion and authentication for it @@ -61,15 +61,17 @@ export async function runMerchantInstancesDeleteTest(t: GlobalTestState) { const baseUrl = merchant.makeInstanceBaseUrl(); { - const r = await axios.get(new URL("config", baseUrl).href); - console.log(r.data); - t.assertDeepEqual(r.data.currency, "TESTKUDOS"); + const r = await harnessHttpLib.fetch(new URL("config", baseUrl).href); + const data = await r.json(); + console.log(data); + t.assertDeepEqual(data.currency, "TESTKUDOS"); } // Instances should initially be empty { - const r = await axios.get(new URL("management/instances", baseUrl).href); - t.assertDeepEqual(r.data.instances, []); + const r = await harnessHttpLib.fetch(new URL("management/instances", baseUrl).href); + const data = await r.json(); + t.assertDeepEqual(data.instances, []); } // Add an instance, no auth! @@ -121,8 +123,8 @@ export async function runMerchantInstancesDeleteTest(t: GlobalTestState) { await unauthMerchantClient.deleteInstance("myinst"); }); console.log("Got expected exception", exc); - t.assertAxiosError(exc); - t.assertDeepEqual(exc.response?.status, 401); + t.assertTrue(exc instanceof TalerError); + t.assertDeepEqual(exc.errorDetail.httpStatusCode, 401); } } diff --git a/packages/taler-harness/src/integrationtests/test-merchant-instances-urls.ts b/packages/taler-harness/src/integrationtests/test-merchant-instances-urls.ts index 534b35278..18a09c76b 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-instances-urls.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-instances-urls.ts @@ -18,8 +18,6 @@ * Imports. */ import { Duration } from "@gnu-taler/taler-util"; -import axiosImp from "axios"; -const axios = axiosImp.default; import { ExchangeService, GlobalTestState, @@ -27,14 +25,14 @@ import { MerchantService, setupDb, getPayto, + harnessHttpLib, } from "../harness/harness.js"; +import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; /** * Do basic checks on instance management and authentication. */ export async function runMerchantInstancesUrlsTest(t: GlobalTestState) { - // Set up test environment - const db = await setupDb(t); const exchange = ExchangeService.create(t, { @@ -111,11 +109,10 @@ export async function runMerchantInstancesUrlsTest(t: GlobalTestState) { }); async function check(url: string, token: string, expectedStatus: number) { - const resp = await axios.get(url, { + const resp = await harnessHttpLib.fetch(url, { headers: { Authorization: `Bearer ${token}`, }, - validateStatus: () => true, }); console.log( `checking ${url}, expected ${expectedStatus}, got ${resp.status}`, diff --git a/packages/taler-harness/src/integrationtests/test-merchant-instances.ts b/packages/taler-harness/src/integrationtests/test-merchant-instances.ts index 78626ea3d..f7d89c543 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-instances.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-instances.ts @@ -18,8 +18,6 @@ * Imports. */ import { URL } from "@gnu-taler/taler-util"; -import axiosImp from "axios"; -const axios = axiosImp.default; import { ExchangeService, GlobalTestState, @@ -27,7 +25,9 @@ import { MerchantService, setupDb, getPayto, + harnessHttpLib, } from "../harness/harness.js"; +import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; /** * Do basic checks on instance management and authentication. @@ -61,15 +61,19 @@ export async function runMerchantInstancesTest(t: GlobalTestState) { const baseUrl = merchant.makeInstanceBaseUrl(); { - const r = await axios.get(new URL("config", baseUrl).href); - console.log(r.data); - t.assertDeepEqual(r.data.currency, "TESTKUDOS"); + const r = await harnessHttpLib.fetch(new URL("config", baseUrl).href); + const data = await r.json(); + console.log(data); + t.assertDeepEqual(data.currency, "TESTKUDOS"); } // Instances should initially be empty { - const r = await axios.get(new URL("management/instances", baseUrl).href); - t.assertDeepEqual(r.data.instances, []); + const r = await harnessHttpLib.fetch( + new URL("management/instances", baseUrl).href, + ); + const data = await r.json(); + t.assertDeepEqual(data.instances, []); } // Add an instance, no auth! @@ -104,11 +108,14 @@ export async function runMerchantInstancesTest(t: GlobalTestState) { // Check that a "malformed" bearer Authorization header gets ignored { const url = merchant.makeInstanceBaseUrl(); - const resp = await axios.get(new URL("management/instances", url).href, { - headers: { - Authorization: "foo bar-baz", + const resp = await harnessHttpLib.fetch( + new URL("management/instances", url).href, + { + headers: { + Authorization: "foo bar-baz", + }, }, - }); + ); t.assertDeepEqual(resp.status, 200); } @@ -130,9 +137,7 @@ export async function runMerchantInstancesTest(t: GlobalTestState) { }); console.log(exc); - - t.assertAxiosError(exc); - t.assertTrue(exc.response?.status === 401); + t.assertTrue(exc.errorDetail.httpStatusCode === 401); merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl(), { method: "token", @@ -145,12 +150,15 @@ export async function runMerchantInstancesTest(t: GlobalTestState) { // Now, try some variations. { const url = merchant.makeInstanceBaseUrl(); - const resp = await axios.get(new URL("management/instances", url).href, { - headers: { - // Note the spaces - Authorization: "Bearer secret-token:foobar", + const resp = await harnessHttpLib.fetch( + new URL("management/instances", url).href, + { + headers: { + // Note the spaces + Authorization: "Bearer secret-token:foobar", + }, }, - }); + ); t.assertDeepEqual(resp.status, 200); } @@ -176,7 +184,7 @@ export async function runMerchantInstancesTest(t: GlobalTestState) { await unauthMerchantClient.deleteInstance("myinst"); }); console.log(exc); - t.assertAxiosError(exc); + t.assertTrue(exc.errorDetail.httpStatusCode === 401); t.assertDeepEqual(exc.response?.status, 401); } } diff --git a/packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts b/packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts index 59f23fe5d..8d271c5d1 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts @@ -24,20 +24,18 @@ import { codecForMerchantOrderStatusUnpaid, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import axiosImp from "axios"; -import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js"; +import { GlobalTestState, MerchantPrivateApi, harnessHttpLib } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2 + withdrawViaBankV2, } from "../harness/helpers.js"; -const axios = axiosImp.default; +import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; /** * Run test for basic, bank-integrated withdrawal. */ export async function runMerchantLongpollingTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, merchant } = await createSimpleTestkudosEnvironmentV2(t); @@ -83,9 +81,7 @@ export async function runMerchantLongpollingTest(t: GlobalTestState) { // First, request order status without longpolling { console.log("requesting", publicOrderStatusUrl.href); - let publicOrderStatusResp = await axios.get(publicOrderStatusUrl.href, { - validateStatus: () => true, - }); + let publicOrderStatusResp = await harnessHttpLib.fetch(publicOrderStatusUrl.href); if (publicOrderStatusResp.status != 402) { throw Error( @@ -98,9 +94,7 @@ export async function runMerchantLongpollingTest(t: GlobalTestState) { publicOrderStatusUrl.searchParams.set("timeout_ms", "500"); console.log("requesting", publicOrderStatusUrl.href); - let publicOrderStatusResp = await axios.get(publicOrderStatusUrl.href, { - validateStatus: () => true, - }); + let publicOrderStatusResp = await harnessHttpLib.fetch(publicOrderStatusUrl.href); if (publicOrderStatusResp.status != 402) { throw Error( @@ -109,7 +103,7 @@ export async function runMerchantLongpollingTest(t: GlobalTestState) { } let pubUnpaidStatus = codecForMerchantOrderStatusUnpaid().decode( - publicOrderStatusResp.data, + await publicOrderStatusResp.json(), ); console.log(pubUnpaidStatus); @@ -135,9 +129,7 @@ export async function runMerchantLongpollingTest(t: GlobalTestState) { preparePayResp.contractTermsHash, ); - let publicOrderStatusPromise = axios.get(publicOrderStatusUrl.href, { - validateStatus: () => true, - }); + let publicOrderStatusPromise = harnessHttpLib.fetch(publicOrderStatusUrl.href); t.assertTrue(preparePayResp.status === PreparePayResultType.PaymentPossible); @@ -152,15 +144,12 @@ export async function runMerchantLongpollingTest(t: GlobalTestState) { } pubUnpaidStatus = codecForMerchantOrderStatusUnpaid().decode( - publicOrderStatusResp.data, + await publicOrderStatusResp.json(), ); - const confirmPayRes = await walletClient.call( - WalletApiOperation.ConfirmPay, - { - proposalId: proposalId, - }, - ); + const confirmPayRes = await walletClient.call(WalletApiOperation.ConfirmPay, { + proposalId: proposalId, + }); t.assertTrue(confirmPayRes.type === ConfirmPayResultType.Done); } diff --git a/packages/taler-harness/src/integrationtests/test-merchant-refund-api.ts b/packages/taler-harness/src/integrationtests/test-merchant-refund-api.ts index 5d9b23fa7..8efac1fc1 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-refund-api.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-refund-api.ts @@ -17,12 +17,14 @@ /** * Imports. */ +import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; import { GlobalTestState, MerchantPrivateApi, MerchantServiceInterface, WalletCli, ExchangeServiceInterface, + harnessHttpLib, } from "../harness/harness.js"; import { createSimpleTestkudosEnvironment, @@ -34,8 +36,6 @@ import { PreparePayResultType, Duration, } from "@gnu-taler/taler-util"; -import axiosImp from "axios"; -const axios = axiosImp.default; import { WalletApiOperation, BankServiceHandle, @@ -136,23 +136,19 @@ async function testRefundApiWithFulfillmentUrl( preparePayResult.contractTermsHash, ); - let publicOrderStatusResp = await axios.get(publicOrderStatusUrl.href, { - validateStatus: () => true, - }); - console.log(publicOrderStatusResp.data); + let publicOrderStatusResp = await harnessHttpLib.fetch(publicOrderStatusUrl.href); + const respData = await publicOrderStatusResp.json(); t.assertTrue(publicOrderStatusResp.status === 200); - t.assertAmountEquals(publicOrderStatusResp.data.refund_amount, "TESTKUDOS:5"); + t.assertAmountEquals(respData.refund_amount, "TESTKUDOS:5"); publicOrderStatusUrl = new URL( `orders/${orderId}`, merchant.makeInstanceBaseUrl(), ); console.log(`requesting order status via '${publicOrderStatusUrl.href}'`); - publicOrderStatusResp = await axios.get(publicOrderStatusUrl.href, { - validateStatus: () => true, - }); + publicOrderStatusResp = await harnessHttpLib.fetch(publicOrderStatusUrl.href); console.log(publicOrderStatusResp.status); - console.log(publicOrderStatusResp.data); + console.log(await publicOrderStatusResp.json()); // We didn't give any authentication, so we should get a fulfillment URL back t.assertTrue(publicOrderStatusResp.status === 403); } @@ -252,22 +248,20 @@ async function testRefundApiWithFulfillmentMessage( preparePayResult.contractTermsHash, ); - let publicOrderStatusResp = await axios.get(publicOrderStatusUrl.href, { - validateStatus: () => true, - }); - console.log(publicOrderStatusResp.data); + let publicOrderStatusResp = await harnessHttpLib.fetch(publicOrderStatusUrl.href); + let respData = await publicOrderStatusResp.json(); + console.log(respData); t.assertTrue(publicOrderStatusResp.status === 200); - t.assertAmountEquals(publicOrderStatusResp.data.refund_amount, "TESTKUDOS:5"); + t.assertAmountEquals(respData.refund_amount, "TESTKUDOS:5"); publicOrderStatusUrl = new URL( `orders/${orderId}`, merchant.makeInstanceBaseUrl(), ); - publicOrderStatusResp = await axios.get(publicOrderStatusUrl.href, { - validateStatus: () => true, - }); - console.log(publicOrderStatusResp.data); + publicOrderStatusResp = await harnessHttpLib.fetch(publicOrderStatusUrl.href); + respData = await publicOrderStatusResp.json(); + console.log(respData); // We didn't give any authentication, so we should get a fulfillment URL back t.assertTrue(publicOrderStatusResp.status === 403); } diff --git a/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts b/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts index 975ba707b..fca368dad 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts @@ -24,7 +24,6 @@ import { encodeCrock, getRandomBytes, } from "@gnu-taler/taler-util"; -import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { BankService, @@ -33,17 +32,13 @@ import { MerchantPrivateApi, MerchantService, WalletCli, + harnessHttpLib, } from "../harness/harness.js"; import { createSimpleTestkudosEnvironment, withdrawViaBank, } from "../harness/helpers.js"; -const httpLib = createPlatformHttpLib({ - allowHttp: true, - enableThrottling: false, -}); - interface Context { merchant: MerchantService; merchantBaseUrl: string; @@ -51,6 +46,8 @@ interface Context { exchange: ExchangeService; } +const httpLib = harnessHttpLib; + async function testWithClaimToken( t: GlobalTestState, c: Context, diff --git a/packages/taler-harness/src/integrationtests/test-pay-paid.ts b/packages/taler-harness/src/integrationtests/test-pay-paid.ts index 2ef91e4a8..a377b7237 100644 --- a/packages/taler-harness/src/integrationtests/test-pay-paid.ts +++ b/packages/taler-harness/src/integrationtests/test-pay-paid.ts @@ -17,7 +17,7 @@ /** * Imports. */ -import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js"; +import { GlobalTestState, MerchantPrivateApi, harnessHttpLib } from "../harness/harness.js"; import { withdrawViaBank, createFaultInjectedMerchantTestkudosEnvironment, @@ -28,8 +28,6 @@ import { ConfirmPayResultType, URL, } from "@gnu-taler/taler-util"; -import axiosImp from "axios"; -const axios = axiosImp.default; import { FaultInjectionRequestContext } from "../harness/faultInjection.js"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; @@ -86,9 +84,7 @@ export async function runPayPaidTest(t: GlobalTestState) { t.assertTrue(orderStatus.already_paid_order_id === undefined); let publicOrderStatusUrl = orderStatus.order_status_url; - let publicOrderStatusResp = await axios.get(publicOrderStatusUrl, { - validateStatus: () => true, - }); + let publicOrderStatusResp = await harnessHttpLib.fetch(publicOrderStatusUrl); if (publicOrderStatusResp.status != 402) { throw Error( @@ -97,7 +93,7 @@ export async function runPayPaidTest(t: GlobalTestState) { } let pubUnpaidStatus = codecForMerchantOrderStatusUnpaid().decode( - publicOrderStatusResp.data, + publicOrderStatusResp.json(), ); console.log(pubUnpaidStatus); @@ -113,9 +109,7 @@ export async function runPayPaidTest(t: GlobalTestState) { const proposalId = preparePayResp.proposalId; - publicOrderStatusResp = await axios.get(publicOrderStatusUrl, { - validateStatus: () => true, - }); + publicOrderStatusResp = await harnessHttpLib.fetch(publicOrderStatusUrl); if (publicOrderStatusResp.status != 402) { throw Error( @@ -124,7 +118,7 @@ export async function runPayPaidTest(t: GlobalTestState) { } pubUnpaidStatus = codecForMerchantOrderStatusUnpaid().decode( - publicOrderStatusResp.data, + publicOrderStatusResp.json(), ); const confirmPayRes = await wallet.client.call( @@ -136,14 +130,12 @@ export async function runPayPaidTest(t: GlobalTestState) { t.assertTrue(confirmPayRes.type === ConfirmPayResultType.Done); - publicOrderStatusResp = await axios.get(publicOrderStatusUrl, { - validateStatus: () => true, - }); + publicOrderStatusResp = await harnessHttpLib.fetch(publicOrderStatusUrl); - console.log(publicOrderStatusResp.data); + console.log(publicOrderStatusResp.json()); if (publicOrderStatusResp.status != 200) { - console.log(publicOrderStatusResp.data); + console.log(publicOrderStatusResp.json()); throw Error( `expected status 200 (after paying), but got ${publicOrderStatusResp.status}`, ); diff --git a/packages/taler-harness/src/integrationtests/test-payment-abort.ts b/packages/taler-harness/src/integrationtests/test-payment-abort.ts index 40438c583..05ca7a543 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-abort.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-abort.ts @@ -17,14 +17,12 @@ /** * Imports. */ -import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js"; +import { GlobalTestState, MerchantPrivateApi, harnessHttpLib } from "../harness/harness.js"; import { withdrawViaBank, createFaultInjectedMerchantTestkudosEnvironment, } from "../harness/helpers.js"; -import { - FaultInjectionRequestContext, -} from "../harness/faultInjection.js"; +import { FaultInjectionRequestContext } from "../harness/faultInjection.js"; import { codecForMerchantOrderStatusUnpaid, ConfirmPayResultType, @@ -35,9 +33,6 @@ import { URL, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import axiosImp from "axios"; - -const axios = axiosImp.default; export async function runPaymentAbortTest(t: GlobalTestState) { // Set up test environment @@ -75,9 +70,7 @@ export async function runPaymentAbortTest(t: GlobalTestState) { t.assertTrue(orderStatus.already_paid_order_id === undefined); let publicOrderStatusUrl = orderStatus.order_status_url; - let publicOrderStatusResp = await axios.get(publicOrderStatusUrl, { - validateStatus: () => true, - }); + let publicOrderStatusResp = await harnessHttpLib.fetch(publicOrderStatusUrl); if (publicOrderStatusResp.status != 402) { throw Error( @@ -86,7 +79,7 @@ export async function runPaymentAbortTest(t: GlobalTestState) { } let pubUnpaidStatus = codecForMerchantOrderStatusUnpaid().decode( - publicOrderStatusResp.data, + publicOrderStatusResp.json(), ); console.log(pubUnpaidStatus); @@ -102,9 +95,7 @@ export async function runPaymentAbortTest(t: GlobalTestState) { const proposalId = preparePayResp.proposalId; - publicOrderStatusResp = await axios.get(publicOrderStatusUrl, { - validateStatus: () => true, - }); + publicOrderStatusResp = await harnessHttpLib.fetch(publicOrderStatusUrl); if (publicOrderStatusResp.status != 402) { throw Error( @@ -113,7 +104,7 @@ export async function runPaymentAbortTest(t: GlobalTestState) { } pubUnpaidStatus = codecForMerchantOrderStatusUnpaid().decode( - publicOrderStatusResp.data, + publicOrderStatusResp.json(), ); faultyMerchant.faultProxy.addFault({ diff --git a/packages/taler-harness/src/integrationtests/test-payment-claim.ts b/packages/taler-harness/src/integrationtests/test-payment-claim.ts index eb219c1e7..3e52cb5dd 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-claim.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-claim.ts @@ -42,13 +42,15 @@ export async function runPaymentClaimTest(t: GlobalTestState) { // Withdraw digital cash into the wallet. - await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: "TESTKUDOS:20", }); + await wres.withdrawalFinishedCond; + // Set up order. const orderResp = await MerchantPrivateApi.createOrder(merchant, "default", { diff --git a/packages/taler-harness/src/integrationtests/test-payment-idempotency.ts b/packages/taler-harness/src/integrationtests/test-payment-idempotency.ts index e16cf9dd1..6373c2393 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-idempotency.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-idempotency.ts @@ -37,13 +37,15 @@ export async function runPaymentIdempotencyTest(t: GlobalTestState) { // Withdraw digital cash into the wallet. - await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: "TESTKUDOS:20", }); + await wres.withdrawalFinishedCond; + // Set up order. const orderResp = await MerchantPrivateApi.createOrder(merchant, "default", { diff --git a/packages/taler-harness/src/integrationtests/test-payment-template.ts b/packages/taler-harness/src/integrationtests/test-payment-template.ts index 172791648..707be52e1 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-template.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-template.ts @@ -50,7 +50,8 @@ export async function runPaymentTemplateTest(t: GlobalTestState) { // Withdraw digital cash into the wallet. - await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: "TESTKUDOS:20" }); + const wres = await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: "TESTKUDOS:20" }); + await wres.withdrawalFinishedCond; // Request a template payment diff --git a/packages/taler-harness/src/integrationtests/test-payment-transient.ts b/packages/taler-harness/src/integrationtests/test-payment-transient.ts index 33a9716d5..c2a8e37c5 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-transient.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-transient.ts @@ -17,23 +17,22 @@ /** * Imports. */ -import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js"; import { - withdrawViaBank, - createFaultInjectedMerchantTestkudosEnvironment, -} from "../harness/helpers.js"; -import { FaultInjectionResponseContext } from "../harness/faultInjection.js"; -import { - codecForMerchantOrderStatusUnpaid, ConfirmPayResultType, PreparePayResultType, TalerErrorCode, TalerErrorDetail, URL, + codecForMerchantOrderStatusUnpaid, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import axiosImp from "axios"; -const axios = axiosImp.default; +import { FaultInjectionResponseContext } from "../harness/faultInjection.js"; +import { GlobalTestState, MerchantPrivateApi, harnessHttpLib } from "../harness/harness.js"; +import { + createFaultInjectedMerchantTestkudosEnvironment, + withdrawViaBank, +} from "../harness/helpers.js"; + /** * Run test for a payment where the merchant has a transient @@ -75,9 +74,7 @@ export async function runPaymentTransientTest(t: GlobalTestState) { t.assertTrue(orderStatus.already_paid_order_id === undefined); let publicOrderStatusUrl = orderStatus.order_status_url; - let publicOrderStatusResp = await axios.get(publicOrderStatusUrl, { - validateStatus: () => true, - }); + let publicOrderStatusResp = await harnessHttpLib.fetch(publicOrderStatusUrl); if (publicOrderStatusResp.status != 402) { throw Error( @@ -86,7 +83,7 @@ export async function runPaymentTransientTest(t: GlobalTestState) { } let pubUnpaidStatus = codecForMerchantOrderStatusUnpaid().decode( - publicOrderStatusResp.data, + publicOrderStatusResp.json(), ); console.log(pubUnpaidStatus); @@ -102,9 +99,7 @@ export async function runPaymentTransientTest(t: GlobalTestState) { const proposalId = preparePayResp.proposalId; - publicOrderStatusResp = await axios.get(publicOrderStatusUrl, { - validateStatus: () => true, - }); + publicOrderStatusResp = await harnessHttpLib.fetch(publicOrderStatusUrl); if (publicOrderStatusResp.status != 402) { throw Error( @@ -113,7 +108,7 @@ export async function runPaymentTransientTest(t: GlobalTestState) { } pubUnpaidStatus = codecForMerchantOrderStatusUnpaid().decode( - publicOrderStatusResp.data, + publicOrderStatusResp.json(), ); let faultInjected = false; @@ -165,14 +160,12 @@ export async function runPaymentTransientTest(t: GlobalTestState) { // Now ask the merchant if paid console.log("requesting", publicOrderStatusUrl); - publicOrderStatusResp = await axios.get(publicOrderStatusUrl, { - validateStatus: () => true, - }); + publicOrderStatusResp = await harnessHttpLib.fetch(publicOrderStatusUrl); - console.log(publicOrderStatusResp.data); + console.log(publicOrderStatusResp.json()); if (publicOrderStatusResp.status != 200) { - console.log(publicOrderStatusResp.data); + console.log(publicOrderStatusResp.json()); throw Error( `expected status 200 (after paying), but got ${publicOrderStatusResp.status}`, ); diff --git a/packages/taler-harness/src/integrationtests/test-paywall-flow.ts b/packages/taler-harness/src/integrationtests/test-paywall-flow.ts index b0477a049..5f63d4fac 100644 --- a/packages/taler-harness/src/integrationtests/test-paywall-flow.ts +++ b/packages/taler-harness/src/integrationtests/test-paywall-flow.ts @@ -17,7 +17,7 @@ /** * Imports. */ -import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js"; +import { GlobalTestState, MerchantPrivateApi, harnessHttpLib } from "../harness/harness.js"; import { PreparePayResultType, codecForMerchantOrderStatusUnpaid, @@ -29,12 +29,6 @@ import { createSimpleTestkudosEnvironmentV2, withdrawViaBankV2, } from "../harness/helpers.js"; -import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; - -const httpLib = createPlatformHttpLib({ - allowHttp: true, - enableThrottling: false, -}); /** * Run test for basic, bank-integrated withdrawal. @@ -47,13 +41,15 @@ export async function runPaywallFlowTest(t: GlobalTestState) { // Withdraw digital cash into the wallet. - await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: "TESTKUDOS:20", }); + await wres.withdrawalFinishedCond; + /** * ========================================================================= * Create an order and let the wallet pay under a session ID @@ -86,7 +82,7 @@ export async function runPaywallFlowTest(t: GlobalTestState) { t.assertTrue(orderStatus.already_paid_order_id === undefined); let publicOrderStatusUrl = new URL(orderStatus.order_status_url); - let publicOrderStatusResp = await httpLib.fetch(publicOrderStatusUrl.href); + let publicOrderStatusResp = await harnessHttpLib.fetch(publicOrderStatusUrl.href); if (publicOrderStatusResp.status != 402) { throw Error( @@ -112,7 +108,7 @@ export async function runPaywallFlowTest(t: GlobalTestState) { const proposalId = preparePayResp.proposalId; console.log("requesting", publicOrderStatusUrl.href); - publicOrderStatusResp = await httpLib.fetch(publicOrderStatusUrl.href); + publicOrderStatusResp = await harnessHttpLib.fetch(publicOrderStatusUrl.href); console.log("response body", publicOrderStatusResp.json()); if (publicOrderStatusResp.status != 402) { throw Error( @@ -129,7 +125,7 @@ export async function runPaywallFlowTest(t: GlobalTestState) { }); t.assertTrue(confirmPayRes.type === ConfirmPayResultType.Done); - publicOrderStatusResp = await httpLib.fetch(publicOrderStatusUrl.href); + publicOrderStatusResp = await harnessHttpLib.fetch(publicOrderStatusUrl.href); console.log(publicOrderStatusResp.json()); @@ -231,7 +227,7 @@ export async function runPaywallFlowTest(t: GlobalTestState) { console.log("requesting public status", publicOrderStatusUrl); // Ask the order status of the claimed-but-unpaid order - publicOrderStatusResp = await httpLib.fetch(publicOrderStatusUrl.href); + publicOrderStatusResp = await harnessHttpLib.fetch(publicOrderStatusUrl.href); if (publicOrderStatusResp.status != 402) { throw Error(`expected status 402, but got ${publicOrderStatusResp.status}`); diff --git a/packages/taler-harness/src/integrationtests/test-refund-auto.ts b/packages/taler-harness/src/integrationtests/test-refund-auto.ts index 607080e68..5648835d5 100644 --- a/packages/taler-harness/src/integrationtests/test-refund-auto.ts +++ b/packages/taler-harness/src/integrationtests/test-refund-auto.ts @@ -36,13 +36,15 @@ export async function runRefundAutoTest(t: GlobalTestState) { // Withdraw digital cash into the wallet. - await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: "TESTKUDOS:20", }); + await wres.withdrawalFinishedCond; + // Set up order. const orderResp = await MerchantPrivateApi.createOrder(merchant, "default", { order: { diff --git a/packages/taler-harness/src/integrationtests/test-refund-incremental.ts b/packages/taler-harness/src/integrationtests/test-refund-incremental.ts index 8e7e38b71..8ac0948f2 100644 --- a/packages/taler-harness/src/integrationtests/test-refund-incremental.ts +++ b/packages/taler-harness/src/integrationtests/test-refund-incremental.ts @@ -45,13 +45,15 @@ export async function runRefundIncrementalTest(t: GlobalTestState) { // Withdraw digital cash into the wallet. - await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: "TESTKUDOS:20", }); + await wres.withdrawalFinishedCond; + // Set up order. const orderResp = await MerchantPrivateApi.createOrder(merchant, "default", { diff --git a/packages/taler-harness/src/integrationtests/test-wallet-balance.ts b/packages/taler-harness/src/integrationtests/test-wallet-balance.ts index 0f75bd96e..15b0fd427 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-balance.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-balance.ts @@ -17,22 +17,11 @@ /** * Imports. */ -import { Amounts, Duration, PreparePayResultType } from "@gnu-taler/taler-util"; +import { Amounts, PreparePayResultType } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js"; -import { - ExchangeService, - FakebankService, - getRandomIban, - GlobalTestState, - MerchantPrivateApi, - MerchantService, - setupDb, - WalletCli, -} from "../harness/harness.js"; +import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2, - withdrawViaBank, withdrawViaBankV2, } from "../harness/helpers.js"; @@ -50,13 +39,15 @@ export async function runWalletBalanceTest(t: GlobalTestState) { // Withdraw digital cash into the wallet. - await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: "TESTKUDOS:20", }); + await wres.withdrawalFinishedCond; + const order = { summary: "Buy me!", amount: "TESTKUDOS:5", diff --git a/packages/taler-harness/src/integrationtests/test-wallet-dbless.ts b/packages/taler-harness/src/integrationtests/test-wallet-dbless.ts index 58f564f34..153ae93d8 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-dbless.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-dbless.ts @@ -23,7 +23,6 @@ import { j2s, TalerError, } from "@gnu-taler/taler-util"; -import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; import { checkReserve, CryptoDispatcher, @@ -36,7 +35,7 @@ import { Wallet, withdrawCoin, } from "@gnu-taler/taler-wallet-core"; -import { GlobalTestState } from "../harness/harness.js"; +import { GlobalTestState, harnessHttpLib } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js"; /** @@ -47,10 +46,7 @@ export async function runWalletDblessTest(t: GlobalTestState) { const { bank, exchange } = await createSimpleTestkudosEnvironmentV2(t); - const http = createPlatformHttpLib({ - allowHttp: true, - enableThrottling: false, - }); + const http = harnessHttpLib; const cryptiDisp = new CryptoDispatcher( new SynchronousCryptoWorkerFactoryPlain(), ); |