aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-harness/src/integrationtests/test-merchant-refund-api.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-08-29 09:02:16 +0200
committerFlorian Dold <florian@dold.me>2023-08-29 09:03:19 +0200
commitb13bd85215ad64e7a2764ac7e7fee5945ffa1c07 (patch)
tree70643c7e76baeb9f61857add603dc381b6f03766 /packages/taler-harness/src/integrationtests/test-merchant-refund-api.ts
parent8941f29cb457f86235b73f125e77a88cb762f353 (diff)
downloadwallet-core-b13bd85215ad64e7a2764ac7e7fee5945ffa1c07.tar.xz
taler-harness: remove axios usage, renovate some tests
Diffstat (limited to 'packages/taler-harness/src/integrationtests/test-merchant-refund-api.ts')
-rw-r--r--packages/taler-harness/src/integrationtests/test-merchant-refund-api.ts34
1 files changed, 14 insertions, 20 deletions
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);
}