taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 2fb5aa6300834b5908630750c4c3d715a0fdb80c
parent 784250423cb120d85142337e0588bacf3fdd8255
Author: Florian Dold <dold@taler.net>
Date:   Thu, 20 Aug 2026 19:06:41 +0200

wallet-core: correct delete-exchange operation type

Diffstat:
Apackages/taler-wallet-core/src/wallet-api-types.test.ts | 31+++++++++++++++++++++++++++++++
Mpackages/taler-wallet-core/src/wallet-api-types.ts | 4++--
2 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/packages/taler-wallet-core/src/wallet-api-types.test.ts b/packages/taler-wallet-core/src/wallet-api-types.test.ts @@ -0,0 +1,31 @@ +/* + This file is part of GNU Taler + (C) 2026 Taler Systems S.A. + + GNU Taler is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>. + */ + +import assert from "node:assert"; +import { test } from "node:test"; +import { DeleteExchangeOp, WalletApiOperation } from "./wallet-api-types.js"; + +test("DeleteExchange operation type has the matching discriminant", () => { + // This assignment is the regression check: it did not type-check while + // DeleteExchangeOp incorrectly declared GetExchangeResources as its tag. + const operation: DeleteExchangeOp = { + op: WalletApiOperation.DeleteExchange, + request: { exchangeBaseUrl: "https://exchange.example/" }, + response: {}, + }; + + assert.strictEqual(operation.op, WalletApiOperation.DeleteExchange); +}); diff --git a/packages/taler-wallet-core/src/wallet-api-types.ts b/packages/taler-wallet-core/src/wallet-api-types.ts @@ -1229,10 +1229,10 @@ export type GetExchangeResourcesOp = { }; /** - * Get resources associated with an exchange. + * Delete an exchange and its associated resources. */ export type DeleteExchangeOp = { - op: WalletApiOperation.GetExchangeResources; + op: WalletApiOperation.DeleteExchange; request: DeleteExchangeRequest; response: EmptyObject; };