diff options
author | Florian Dold <florian@dold.me> | 2024-06-05 19:37:49 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-06-05 19:37:49 +0200 |
commit | 93623571b0146c9a67085455bc3721e106a207cb (patch) | |
tree | 24313826ace1485690f4975247d93185efb6cde7 /packages/taler-harness | |
parent | 7631db2a902664f475b9074e305a95b0ad71a9df (diff) | |
download | wallet-core-93623571b0146c9a67085455bc3721e106a207cb.tar.xz |
wallet-core: properly adjust visibleCoinCount in availability record when refreshing a fresh coin
Diffstat (limited to 'packages/taler-harness')
-rw-r--r-- | packages/taler-harness/src/harness/harness.ts | 4 | ||||
-rw-r--r-- | packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts | 21 |
2 files changed, 10 insertions, 15 deletions
diff --git a/packages/taler-harness/src/harness/harness.ts b/packages/taler-harness/src/harness/harness.ts index 136ec3d15..4fc462ddf 100644 --- a/packages/taler-harness/src/harness/harness.ts +++ b/packages/taler-harness/src/harness/harness.ts @@ -274,6 +274,7 @@ export class GlobalTestState { procs: ProcessWrapper[]; servers: http.Server[]; inShutdown: boolean = false; + stepSet: Set<string> = new Set(); constructor(params: GlobalTestParams) { this.testDir = params.testDir; this.procs = []; @@ -423,6 +424,9 @@ export class GlobalTestState { // Now we just log, later we may report the steps that were done // to easily see where the test hangs. console.info(`STEP: ${stepName}`); + if (this.stepSet.has(stepName)) { + throw Error(`duplicate step (${stepName})`); + } } } diff --git a/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts b/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts index 8b8b45c40..f3e3802e5 100644 --- a/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts +++ b/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts @@ -18,14 +18,12 @@ * Imports. */ import { - Amounts, ConfirmPayResultType, Duration, MerchantApiClient, NotificationType, PreparePayResultType, TalerCorebankApiClient, - j2s, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { makeNoFeeCoinConfig } from "../harness/denomStructures.js"; @@ -134,6 +132,7 @@ export async function runTimetravelAutorefreshTest(t: GlobalTestState) { const { walletClient } = await createWalletDaemonWithClient(t, { name: "w1", + persistent: true, }); const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl()); @@ -160,9 +159,7 @@ export async function runTimetravelAutorefreshTest(t: GlobalTestState) { await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); { const balance = await walletClient.call(WalletApiOperation.GetBalances, {}); - t.assertTrue( - Amounts.cmp(balance.balances[0].available, "TESTKUDOS:15") === 0, - ); + t.assertAmountEquals(balance.balances[0].available, "TESTKUDOS:15"); } // Travel into the future, the deposit expiration is two years @@ -180,13 +177,11 @@ export async function runTimetravelAutorefreshTest(t: GlobalTestState) { // The time travel should cause exchanges to update. t.logStep("The time travel should cause exchanges to update"); await exchangeUpdated1Cond; - t.logStep("exchange updated, wahting tx"); + t.logStep("exchange updated, waiting for tx"); await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); { const balance = await walletClient.call(WalletApiOperation.GetBalances, {}); - t.assertTrue( - Amounts.cmp(balance.balances[0].available, "TESTKUDOS:15") === 0, - ); + t.assertAmountEquals(balance.balances[0].available, "TESTKUDOS:15"); } t.logStep("withdrawing second time"); @@ -203,9 +198,7 @@ export async function runTimetravelAutorefreshTest(t: GlobalTestState) { { const balance = await walletClient.call(WalletApiOperation.GetBalances, {}); - t.assertTrue( - Amounts.cmp(balance.balances[0].available, "TESTKUDOS:35") === 0, - ); + t.assertAmountEquals(balance.balances[0].available, "TESTKUDOS:35"); } const exchangeUpdated2Cond = walletClient.waitForNotificationCond( @@ -232,9 +225,7 @@ export async function runTimetravelAutorefreshTest(t: GlobalTestState) { await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); { const balance = await walletClient.call(WalletApiOperation.GetBalances, {}); - t.assertTrue( - Amounts.cmp(balance.balances[0].available, "TESTKUDOS:35") === 0, - ); + t.assertAmountEquals(balance.balances[0].available, "TESTKUDOS:35"); } // At this point, the original coins should've been refreshed. |