aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-harness/src/integrationtests/test-wallet-backup-doublespend.ts
diff options
context:
space:
mode:
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.ts47
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,
+ {},
+ );
}
}