diff options
author | Florian Dold <florian@dold.me> | 2023-02-21 21:02:36 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-02-21 21:02:36 +0100 |
commit | b648238c4120ed341c76818b4ffa223d0122af78 (patch) | |
tree | dff1c75182170cfeed76c8d926e919470f2c9d71 /packages/taler-harness/src/harness | |
parent | a3c7da975b6375f8c57154875642fb29a67e8731 (diff) | |
download | wallet-core-b648238c4120ed341c76818b4ffa223d0122af78.tar.xz |
harness: improve peer-pull integration test, check notificationsv0.9.3-dev.2
Diffstat (limited to 'packages/taler-harness/src/harness')
-rw-r--r-- | packages/taler-harness/src/harness/helpers.ts | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/packages/taler-harness/src/harness/helpers.ts b/packages/taler-harness/src/harness/helpers.ts index c1ce463fa..d203cc608 100644 --- a/packages/taler-harness/src/harness/helpers.ts +++ b/packages/taler-harness/src/harness/helpers.ts @@ -31,6 +31,7 @@ import { PreparePayResultType, NotificationType, WithdrawalGroupFinishedNotification, + WalletNotification, } from "@gnu-taler/taler-util"; import { BankAccessApi, @@ -297,7 +298,6 @@ export async function createSimpleTestkudosEnvironmentV2( const walletService = new WalletService(t, { name: "wallet", - useInMemoryDb: true, }); await walletService.start(); await walletService.pingUntilAvailable(); @@ -326,6 +326,39 @@ export async function createSimpleTestkudosEnvironmentV2( }; } +export interface CreateWalletArgs { + handleNotification?(wn: WalletNotification): void; + name: string; +} + +export async function createWalletDaemonWithClient( + t: GlobalTestState, + args: CreateWalletArgs, +): Promise<{ walletClient: WalletClient; walletService: WalletService }> { + const walletService = new WalletService(t, { + name: "wallet", + useInMemoryDb: true, + }); + await walletService.start(); + await walletService.pingUntilAvailable(); + + const walletClient = new WalletClient({ + unixPath: walletService.socketPath, + onNotification(n) { + console.log("got notification", n); + if (args.handleNotification) { + args.handleNotification(n); + } + }, + }); + await walletClient.connect(); + await walletClient.client.call(WalletApiOperation.InitWallet, { + skipDefaults: true, + }); + + return { walletClient, walletService }; +} + export interface FaultyMerchantTestEnvironment { commonDb: DbInfo; bank: BankService; |