diff options
Diffstat (limited to 'packages/taler-wallet-core/src/operations/testing.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/testing.ts | 41 |
1 files changed, 1 insertions, 40 deletions
diff --git a/packages/taler-wallet-core/src/operations/testing.ts b/packages/taler-wallet-core/src/operations/testing.ts index 4c2cfae2c..5902e8362 100644 --- a/packages/taler-wallet-core/src/operations/testing.ts +++ b/packages/taler-wallet-core/src/operations/testing.ts @@ -62,6 +62,7 @@ import { import { InternalWalletState } from "../internal-wallet-state.js"; import { checkLogicInvariant } from "../util/invariants.js"; import { getBalances } from "./balance.js"; +import { createDepositGroup } from "./deposits.js"; import { fetchFreshExchange } from "./exchanges.js"; import { confirmPay, @@ -78,10 +79,8 @@ import { preparePeerPushCredit, } from "./pay-peer-push-credit.js"; import { initiatePeerPushDebit } from "./pay-peer-push-debit.js"; -import { getPendingOperations } from "./pending.js"; import { getTransactionById, getTransactions } from "./transactions.js"; import { acceptWithdrawalFromUri } from "./withdraw.js"; -import { createDepositGroup } from "./deposits.js"; const logger = new Logger("operations/testing.ts"); @@ -521,44 +520,6 @@ export async function waitUntilGivenTransactionsFinal( logger.info("done waiting until given transactions are in a final state"); } -/** - * Wait until pending work is processed. - */ -export async function waitUntilTasksProcessed( - ws: InternalWalletState, -): Promise<void> { - logger.info("waiting until pending work is processed"); - ws.ensureTaskLoopRunning(); - let p: OpenedPromise<void> | undefined = undefined; - const cancelNotifs = ws.addNotificationListener((notif) => { - if (!p) { - return; - } - if (notif.type === NotificationType.PendingOperationProcessed) { - p.resolve(); - } - }); - while (1) { - p = openPromise(); - const pendingTasksResp = await getPendingOperations(ws); - logger.info(`waiting on pending ops: ${j2s(pendingTasksResp)}`); - let finished = true; - for (const task of pendingTasksResp.pendingOperations) { - if (task.isDue) { - finished = false; - } - logger.info(`continuing waiting for task ${task.id}`); - } - if (finished) { - break; - } - // Wait until task is done - await p.promise; - } - logger.info("done waiting until pending work is processed"); - cancelNotifs(); -} - export async function waitUntilRefreshesDone( ws: InternalWalletState, ): Promise<void> { |