taler-typescript-core

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

commit 7401814819447117ce332558ea5ac9dd6d3d0b7d
parent b69bcd14426292a8c1373312c0e2d68ee7d85e3e
Author: Martin Schanzenbach <schanzen@gnunet.org>
Date:   Wed, 29 Oct 2025 12:55:37 +0100

Add integration test for contacts

Diffstat:
Apackages/taler-harness/src/integrationtests/test-wallet-contacts-basic.ts | 76++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mpackages/taler-harness/src/integrationtests/testrunner.ts | 2++
2 files changed, 78 insertions(+), 0 deletions(-)

diff --git a/packages/taler-harness/src/integrationtests/test-wallet-contacts-basic.ts b/packages/taler-harness/src/integrationtests/test-wallet-contacts-basic.ts @@ -0,0 +1,76 @@ +/* + This file is part of GNU Taler + (C) 2025 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/> + */ + +/** + * Imports. + */ +import { j2s } from "@gnu-taler/taler-util"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; +import { GlobalTestState } from "../harness/harness.js"; +import { + createSimpleTestkudosEnvironmentV3, + createWalletDaemonWithClient, + withdrawViaBankV3, +} from "../harness/environments.js"; + +/** + * Run test for basic contact operations. + */ +export async function runWalletContactsBasicTest(t: GlobalTestState) { + // Set up test environment + + const { commonDb, merchant, walletClient, bankClient, exchange } = + await createSimpleTestkudosEnvironmentV3(t); + + const contactBob = { + alias: "bobexample.com", + aliasType: "email", + mailboxUri: "https://mailbox.example.com/BOBPKEY", + source: "test" + }; + const contactAlice = { + alias: "@alice", + aliasType: "social", + mailboxUri: "https://mailbox.example.com/ALICEPKEY", + source: "test" + }; + await walletClient.call(WalletApiOperation.AddContact, { + contact: contactAlice, + }); + await walletClient.call(WalletApiOperation.AddContact, { + contact: contactBob, + }); + + + { + const bi = await walletClient.call(WalletApiOperation.GetContacts, {}); + t.assertDeepEqual(bi.contacts.length, 2); + } + + await walletClient.call(WalletApiOperation.DeleteContact, { + contact: contactBob, + }); + + { + const bi = await walletClient.call(WalletApiOperation.GetContacts, {}); + t.assertDeepEqual(bi.contacts.length, 1); + t.assertDeepEqual(bi.contacts[0].alias, "@alice"); + } + +} + +runWalletContactsBasicTest.suites = ["wallet", "wallet-contacts"]; +runWalletContactsBasicTest.experimental = true; diff --git a/packages/taler-harness/src/integrationtests/testrunner.ts b/packages/taler-harness/src/integrationtests/testrunner.ts @@ -168,6 +168,7 @@ import { runWalletBlockedPayPeerPullTest } from "./test-wallet-blocked-pay-peer- import { runWalletBlockedPayPeerPushTest } from "./test-wallet-blocked-pay-peer-push.js"; import { runWalletCliTerminationTest } from "./test-wallet-cli-termination.js"; import { runWalletConfigTest } from "./test-wallet-config.js"; +import { runWalletContactsBasicTest } from "./test-wallet-contacts-basic.js"; import { runWalletCryptoWorkerTest } from "./test-wallet-cryptoworker.js"; import { runWalletDblessTest } from "./test-wallet-dbless.js"; import { runWalletDd48Test } from "./test-wallet-dd48.js"; @@ -273,6 +274,7 @@ const allTests: TestMainFunction[] = [ runWalletBackupDoublespendTest, runWalletNotificationsTest, runWalletCryptoWorkerTest, + runWalletContactsBasicTest, runWalletDblessTest, runWallettestingTest, runWithdrawalAbortBankTest,