commit cdc80af8b37da3043b773f8f1871d08e093766a9
parent d110955ec59e39751b2ce567c0c6d81b2c175ab3
Author: Özgür Kesim <oec@codeblau.de>
Date: Sun, 8 Nov 2026 18:30:39 +0100
wallet-core: give the auto-refresh waiter test a withdrawable denomination
waitReadyExchange() waits for one since 222b64411.
Diffstat:
1 file changed, 44 insertions(+), 0 deletions(-)
diff --git a/packages/taler-wallet-core/src/wallet-notifications.test.ts b/packages/taler-wallet-core/src/wallet-notifications.test.ts
@@ -20,6 +20,7 @@ import {
AbsoluteTime,
CancellationToken,
ContractTermsUtil,
+ DenomKeyType,
encodeCrock,
NotificationType,
openPromise,
@@ -37,10 +38,13 @@ import { DbRetryInfo, TaskIdentifiers, TaskIdStr } from "./common.js";
import { SynchronousCryptoWorkerFactoryPlain } from "./crypto/workers/synchronousWorkerFactoryPlain.js";
import {
ConfigRecordKey,
+ DenominationVerificationStatus,
ExchangeEntryDbRecordStatus,
ExchangeEntryDbUpdateStatus,
PurchaseStatus,
timestampPreciseToDb,
+ timestampProtocolToDb,
+ WalletDenomination,
WalletExchangeDetails,
WalletExchangeEntry,
WalletPurchase,
@@ -100,6 +104,43 @@ function contract(deadline: number, nonce = master) {
};
}
+/**
+ * A denomination of the fixture's exchange that can be withdrawn now;
+ * waitReadyExchange() only reports an exchange with one as ready.
+ */
+function withdrawableDenom(): WalletDenomination {
+ const now = Math.floor(AbsoluteTime.toStampMs(AbsoluteTime.now()) / 1000);
+ const day = 86400;
+ const stamp = (s: number) => timestampProtocolToDb({ t_s: s });
+ return {
+ exchangeBaseUrl: exchangeUrl,
+ exchangeMasterPub: master,
+ denomPubHash: encodeCrock(new Uint8Array(64)),
+ denomPub: {
+ cipher: DenomKeyType.Rsa,
+ rsa_public_key: "dummy",
+ age_mask: 0,
+ },
+ currency: "TESTKUDOS",
+ value: "TESTKUDOS:1",
+ stampStart: stamp(now - day),
+ stampExpireWithdraw: stamp(now + 30 * day),
+ stampExpireDeposit: stamp(now + 60 * day),
+ stampExpireLegal: stamp(now + 90 * day),
+ fees: {
+ feeWithdraw: "TESTKUDOS:0",
+ feeRefresh: "TESTKUDOS:0",
+ feeDeposit: "TESTKUDOS:0",
+ feeRefund: "TESTKUDOS:0",
+ },
+ isOffered: true,
+ isLost: false,
+ isRevoked: false,
+ masterSig: signature,
+ verificationStatus: DenominationVerificationStatus.VerifiedGood,
+ };
+}
+
function purchase(id = "proposal"): WalletPurchase {
return {
proposalId: id,
@@ -227,6 +268,9 @@ for (const makeRunner of runnerFactories) {
async () => {
const f = await fixture(makeRunner);
try {
+ await f.db.runReadWriteTx((tx) =>
+ tx.upsertDenomination(withdrawableDenom()),
+ );
const checked = openPromise<void>();
let reads = 0;
const waitWex: WalletExecutionContext = {