aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-08-12 19:52:51 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-08-12 19:52:51 +0530
commit44dcfb379005097e6337754f8bf8ff267e5c8deb (patch)
tree9b5f6fda889ac94a7875eabe76492a074e00501a
parentc5ec34136874be87210711fd65eea1c1a6feec50 (diff)
check error code
-rw-r--r--packages/taler-integrationtests/src/test-exchange-management.ts17
1 files changed, 15 insertions, 2 deletions
diff --git a/packages/taler-integrationtests/src/test-exchange-management.ts b/packages/taler-integrationtests/src/test-exchange-management.ts
index 990a6fa4e..9199c183e 100644
--- a/packages/taler-integrationtests/src/test-exchange-management.ts
+++ b/packages/taler-integrationtests/src/test-exchange-management.ts
@@ -32,6 +32,7 @@ import {
PreparePayResultType,
ExchangesListRespose,
URL,
+ TalerErrorCode,
} from "taler-wallet-core";
import {
FaultInjectedExchangeService,
@@ -165,12 +166,19 @@ runTest(async (t: GlobalTestState) => {
},
});
- await t.assertThrowsOperationErrorAsync(async () => {
+ const err1 = await t.assertThrowsOperationErrorAsync(async () => {
await wallet.addExchange({
exchangeBaseUrl: faultyExchange.baseUrl,
});
});
+ // Response is malformed, since it didn't even contain a version code
+ // in a format the wallet can understand.
+ t.assertTrue(
+ err1.operationError.talerErrorCode ===
+ TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,
+ );
+
exchangesList = await wallet.listExchanges();
t.assertTrue(exchangesList.exchanges.length === 0);
@@ -197,12 +205,17 @@ runTest(async (t: GlobalTestState) => {
},
});
- await t.assertThrowsOperationErrorAsync(async () => {
+ const err2 = await t.assertThrowsOperationErrorAsync(async () => {
await wallet.addExchange({
exchangeBaseUrl: faultyExchange.baseUrl,
});
});
+ t.assertTrue(
+ err2.operationError.talerErrorCode ===
+ TalerErrorCode.WALLET_EXCHANGE_PROTOCOL_VERSION_INCOMPATIBLE,
+ );
+
exchangesList = await wallet.listExchanges();
t.assertTrue(exchangesList.exchanges.length === 0);