diff options
author | Florian Dold <florian@dold.me> | 2023-09-05 10:46:06 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-09-05 10:48:41 +0200 |
commit | a60a1d867cfe6a12f1e6fadfa037f022e9385107 (patch) | |
tree | bc77a92b327cd0e4933fa4b3fe15f1c775e24235 /packages/taler-harness/src/integrationtests/test-wallet-backup-doublespend.ts | |
parent | e1d86816a7c07cb8ca2d54676d5cdbbe513f2ba7 (diff) | |
download | wallet-core-a60a1d867cfe6a12f1e6fadfa037f022e9385107.tar.xz |
harness: remove deprecated testing APIs
Diffstat (limited to 'packages/taler-harness/src/integrationtests/test-wallet-backup-doublespend.ts')
-rw-r--r-- | packages/taler-harness/src/integrationtests/test-wallet-backup-doublespend.ts | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-wallet-backup-doublespend.ts b/packages/taler-harness/src/integrationtests/test-wallet-backup-doublespend.ts index e3e18d5a4..99adc1754 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-backup-doublespend.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-backup-doublespend.ts @@ -19,16 +19,12 @@ */ import { PreparePayResultType } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { - GlobalTestState, - MerchantPrivateApi, - WalletCli, -} from "../harness/harness.js"; +import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2, + createWalletDaemonWithClient, makeTestPaymentV2, - withdrawViaBank, - withdrawViaBankV2 + withdrawViaBankV2, } from "../harness/helpers.js"; import { SyncService } from "../harness/sync.js"; @@ -58,7 +54,12 @@ export async function runWalletBackupDoublespendTest(t: GlobalTestState) { name: sync.baseUrl, }); - await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: "TESTKUDOS:10" }); + await withdrawViaBankV2(t, { + walletClient, + bank, + exchange, + amount: "TESTKUDOS:10", + }); await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); @@ -71,13 +72,16 @@ export async function runWalletBackupDoublespendTest(t: GlobalTestState) { {}, ); - const wallet2 = new WalletCli(t, "wallet2"); + const { walletClient: walletClientTwo } = await createWalletDaemonWithClient( + t, + { name: "default" }, + ); - await wallet2.client.call(WalletApiOperation.ImportBackupRecovery, { + await walletClientTwo.call(WalletApiOperation.ImportBackupRecovery, { recovery: backupRecovery, }); - await wallet2.client.call(WalletApiOperation.RunBackupCycle, {}); + await walletClientTwo.call(WalletApiOperation.RunBackupCycle, {}); console.log( "wallet1 balance before spend:", @@ -103,7 +107,7 @@ export async function runWalletBackupDoublespendTest(t: GlobalTestState) { { console.log( "wallet2 balance:", - await wallet2.client.call(WalletApiOperation.GetBalances, {}), + await walletClientTwo.call(WalletApiOperation.GetBalances, {}), ); } @@ -134,11 +138,11 @@ export async function runWalletBackupDoublespendTest(t: GlobalTestState) { { console.log( "wallet2 balance before preparePay:", - await wallet2.client.call(WalletApiOperation.GetBalances, {}), + await walletClientTwo.call(WalletApiOperation.GetBalances, {}), ); } - const preparePayResult = await wallet2.client.call( + const preparePayResult = await walletClientTwo.call( WalletApiOperation.PreparePayForUri, { talerPayUri: orderStatus.taler_pay_uri, @@ -150,25 +154,28 @@ export async function runWalletBackupDoublespendTest(t: GlobalTestState) { PreparePayResultType.PaymentPossible, ); - const res = await wallet2.client.call(WalletApiOperation.ConfirmPay, { - proposalId: preparePayResult.proposalId, + const res = await walletClientTwo.call(WalletApiOperation.ConfirmPay, { + transactionId: preparePayResult.transactionId, }); console.log(res); // FIXME: wait for a notification that indicates insufficient funds! - await withdrawViaBank(t, { - wallet: wallet2, + await withdrawViaBankV2(t, { + walletClient: walletClientTwo, bank, exchange, amount: "TESTKUDOS:50", }); - const bal = await wallet2.client.call(WalletApiOperation.GetBalances, {}); + const bal = await walletClientTwo.call(WalletApiOperation.GetBalances, {}); console.log("bal", bal); - await wallet2.runUntilDone(); + await walletClientTwo.call( + WalletApiOperation.TestingWaitTransactionsFinal, + {}, + ); } } |