/* This file is part of GNU Taler (C) 2024 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 */ /** * Imports. */ import { AmountString } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js"; import { BankService, ExchangeService, GlobalTestState, MerchantService, WalletCli, generateRandomPayto, setupDb, } from "../harness/harness.js"; /** * Test that run-until-done of taler-wallet-cli terminates. */ export async function runWalletCliTerminationTest(t: GlobalTestState) { const db = await setupDb(t); const coinConfig: CoinConfig[] = defaultCoinConfig.map((x) => x("TESTKUDOS")); const bank = await BankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: db.connStr, httpPort: 8082, }); const exchange = ExchangeService.create(t, { name: "testexchange-1", currency: "TESTKUDOS", httpPort: 8081, database: db.connStr, }); const merchant = await MerchantService.create(t, { name: "testmerchant-1", currency: "TESTKUDOS", httpPort: 8083, database: db.connStr, }); const exchangeBankAccount = await bank.createExchangeAccount( "myexchange", "x", ); exchange.addBankAccount("1", exchangeBankAccount); bank.setSuggestedExchange(exchange, exchangeBankAccount.accountPaytoUri); await bank.start(); await bank.pingUntilAvailable(); exchange.addCoinConfigList(coinConfig); await exchange.start(); await exchange.pingUntilAvailable(); merchant.addExchange(exchange); await merchant.start(); await merchant.pingUntilAvailable(); await merchant.addInstanceWithWireAccount({ id: "default", name: "Default Instance", paytoUris: [generateRandomPayto("merchant-default")], }); const wallet = new WalletCli(t, "wallet"); await wallet.client.call(WalletApiOperation.WithdrawTestBalance, { corebankApiBaseUrl: bank.corebankApiBaseUrl, exchangeBaseUrl: exchange.baseUrl, amount: "TESTKUDOS:20" as AmountString, }); await wallet.runUntilDone(); } runWalletCliTerminationTest.suites = ["wallet"];