diff options
author | Florian Dold <florian@dold.me> | 2021-04-07 19:29:51 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-04-07 19:29:51 +0200 |
commit | 4fa88007f958796d7fe65d0fe4f6f45fcf953887 (patch) | |
tree | 4f6e5798cc74b19b6eda13dfcd5daa855a5c8c9a /packages/taler-wallet-cli/src/integrationtests | |
parent | 29d710c392c2b28e8c8c2a177c8de40061a58e77 (diff) | |
download | wallet-core-4fa88007f958796d7fe65d0fe4f6f45fcf953887.tar.xz |
get coin re-selection after accidental double spending to work
Diffstat (limited to 'packages/taler-wallet-cli/src/integrationtests')
-rw-r--r-- | packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-basic.ts | 30 | ||||
-rw-r--r-- | packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-doublespend.ts | 20 |
2 files changed, 38 insertions, 12 deletions
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-basic.ts b/packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-basic.ts index 2ed16fe19..dd448c87d 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-basic.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-basic.ts @@ -17,12 +17,8 @@ /** * Imports. */ -import { GlobalTestState, BankApi, BankAccessApi, WalletCli } from "./harness"; -import { - createSimpleTestkudosEnvironment, - makeTestPayment, - withdrawViaBank, -} from "./helpers"; +import { GlobalTestState, WalletCli } from "./harness"; +import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers"; import { SyncService } from "./sync"; /** @@ -101,7 +97,7 @@ export async function runWalletBackupBasicTest(t: GlobalTestState) { const bi = await wallet.getBackupInfo(); console.log(bi); } - + const backupRecovery = await wallet.exportBackupRecovery(); const wallet2 = new WalletCli(t, "wallet2"); @@ -122,4 +118,24 @@ export async function runWalletBackupBasicTest(t: GlobalTestState) { t.assertTrue(bal.balances.length === 1); console.log(bal); } + + // Now do some basic checks that the restored wallet is still functional + { + const bal1 = await wallet2.getBalances(); + + t.assertAmountEquals(bal1.balances[0].available, "TESTKUDOS:14.1"); + + await withdrawViaBank(t, { + wallet: wallet2, + bank, + exchange, + amount: "TESTKUDOS:10", + }); + + await wallet2.runUntilDone(); + + const bal2 = await wallet2.getBalances(); + + t.assertAmountEquals(bal2.balances[0].available, "TESTKUDOS:23.82"); + } } diff --git a/packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-doublespend.ts b/packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-doublespend.ts index ef53046cd..b9bc30a95 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-doublespend.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-doublespend.ts @@ -18,11 +18,7 @@ * Imports. */ import { PreparePayResultType } from "@gnu-taler/taler-util"; -import { - GlobalTestState, - WalletCli, - MerchantPrivateApi, -} from "./harness"; +import { GlobalTestState, WalletCli, MerchantPrivateApi } from "./harness"; import { createSimpleTestkudosEnvironment, makeTestPayment, @@ -133,5 +129,19 @@ export async function runWalletBackupDoublespendTest(t: GlobalTestState) { }); console.log(res); + + // FIXME: wait for a notification that indicates insufficient funds! + + await withdrawViaBank(t, { + wallet: wallet2, + bank, + exchange, + amount: "TESTKUDOS:50", + }); + + const bal = await wallet2.getBalances(); + console.log("bal", bal); + + await wallet2.runUntilDone(); } } |