diff options
author | Florian Dold <florian@dold.me> | 2022-03-22 21:16:38 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-03-22 21:16:38 +0100 |
commit | 5d23eb36354d07508a015531f298b3e261bbafce (patch) | |
tree | fae0d2599c94d88c9264bb63a301adb1706824c1 /packages/taler-wallet-cli/src/integrationtests/test-denom-unoffered.ts | |
parent | f8d12f7b0d4af1b1769b89e80c87f9c169678564 (diff) | |
download | wallet-core-5d23eb36354d07508a015531f298b3e261bbafce.tar.gz wallet-core-5d23eb36354d07508a015531f298b3e261bbafce.tar.bz2 wallet-core-5d23eb36354d07508a015531f298b3e261bbafce.zip |
wallet: improve error handling and error codes
Diffstat (limited to 'packages/taler-wallet-cli/src/integrationtests/test-denom-unoffered.ts')
-rw-r--r-- | packages/taler-wallet-cli/src/integrationtests/test-denom-unoffered.ts | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-denom-unoffered.ts b/packages/taler-wallet-cli/src/integrationtests/test-denom-unoffered.ts index 28cca0758..ec1d9f64b 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-denom-unoffered.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-denom-unoffered.ts @@ -20,25 +20,21 @@ import { PreparePayResultType, TalerErrorCode, - TalerErrorDetails, - TransactionType, + TalerErrorDetail, } from "@gnu-taler/taler-util"; -import { - WalletApiOperation, -} from "@gnu-taler/taler-wallet-core"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { makeEventId } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js"; -import { createSimpleTestkudosEnvironment, withdrawViaBank } from "../harness/helpers.js"; +import { + createSimpleTestkudosEnvironment, + withdrawViaBank, +} from "../harness/helpers.js"; export async function runDenomUnofferedTest(t: GlobalTestState) { // Set up test environment - const { - wallet, - bank, - exchange, - merchant, - } = await createSimpleTestkudosEnvironment(t); + const { wallet, bank, exchange, merchant } = + await createSimpleTestkudosEnvironment(t); // Withdraw digital cash into the wallet. @@ -95,19 +91,23 @@ export async function runDenomUnofferedTest(t: GlobalTestState) { preparePayResult.status === PreparePayResultType.PaymentPossible, ); - const exc = await t.assertThrowsAsync(async () => { + const exc = await t.assertThrowsTalerErrorAsync(async () => { await wallet.client.call(WalletApiOperation.ConfirmPay, { proposalId: preparePayResult.proposalId, }); }); - const errorDetails: TalerErrorDetails = exc.operationError; + t.assertTrue( + exc.hasErrorCode(TalerErrorCode.WALLET_PENDING_OPERATION_FAILED), + ); + // FIXME: We might want a more specific error code here! t.assertDeepEqual( - errorDetails.code, + exc.errorDetail.innerError.code, TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR, ); - const merchantErrorCode = (errorDetails.details as any).errorResponse.code; + const merchantErrorCode = (exc.errorDetail.innerError.errorResponse as any) + .code; t.assertDeepEqual( merchantErrorCode, TalerErrorCode.MERCHANT_POST_ORDERS_ID_PAY_DENOMINATION_KEY_NOT_FOUND, |