summaryrefslogtreecommitdiff
path: root/src/headless/helpers.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-08-01 13:52:08 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-08-01 13:52:46 +0530
commitaa481e42675fb7c4dcbbeec0ba1c61e1953b9596 (patch)
treeb1283f27713b9ff8619773a96b775a263e4aea18 /src/headless/helpers.ts
parentb37c98346d407c749a5cd971f798428c42b248c3 (diff)
downloadwallet-core-aa481e42675fb7c4dcbbeec0ba1c61e1953b9596.tar.gz
wallet-core-aa481e42675fb7c4dcbbeec0ba1c61e1953b9596.tar.bz2
wallet-core-aa481e42675fb7c4dcbbeec0ba1c61e1953b9596.zip
use wallet's http lib for test balance withdrawal, remove redundant integration tests
Diffstat (limited to 'src/headless/helpers.ts')
-rw-r--r--src/headless/helpers.ts50
1 files changed, 2 insertions, 48 deletions
diff --git a/src/headless/helpers.ts b/src/headless/helpers.ts
index 3b2f65313..570ec9e69 100644
--- a/src/headless/helpers.ts
+++ b/src/headless/helpers.ts
@@ -26,18 +26,15 @@ import { Wallet } from "../wallet";
import { MemoryBackend, BridgeIDBFactory, shimIndexedDB } from "idb-bridge";
import { openTalerDatabase } from "../db";
import { HttpRequestLibrary } from "../util/http";
-import { Bank } from "./bank";
import fs from "fs";
import { NodeThreadCryptoWorkerFactory } from "../crypto/workers/nodeThreadWorker";
-import { WalletNotification, NotificationType } from "../types/notifications";
+import { WalletNotification } from "../types/notifications";
import { Database } from "../util/query";
import { NodeHttpLib } from "./NodeHttpLib";
import { Logger } from "../util/logging";
import { SynchronousCryptoWorkerFactory } from "../crypto/workers/synchronousWorker";
-import { WithdrawalSourceType } from "../types/dbTypes";
-import { Amounts } from "../util/amounts";
-const logger = new Logger("helpers.ts");
+const logger = new Logger("headless/helpers.ts");
export interface DefaultNodeWalletArgs {
/**
@@ -135,46 +132,3 @@ export async function getDefaultNodeWallet(
}
return w;
}
-
-export async function withdrawTestBalance(
- myWallet: Wallet,
- amount = "TESTKUDOS:10",
- bankBaseUrl = "https://bank.test.taler.net/",
- exchangeBaseUrl = "https://exchange.test.taler.net/",
-): Promise<void> {
- await myWallet.updateExchangeFromUrl(exchangeBaseUrl, true);
- const reserveResponse = await myWallet.acceptManualWithdrawal(
- exchangeBaseUrl,
- Amounts.parseOrThrow(amount),
- );
-
- const reservePub = reserveResponse.reservePub;
-
- const bank = new Bank(bankBaseUrl);
-
- const bankUser = await bank.registerRandomUser();
-
- logger.trace(`Registered bank user ${JSON.stringify(bankUser)}`);
-
- const exchangePaytoUri = await myWallet.getExchangePaytoUri(exchangeBaseUrl, [
- "x-taler-bank",
- ]);
-
- const donePromise = new Promise((resolve, reject) => {
- myWallet.runRetryLoop().catch((x) => {
- reject(x);
- });
- myWallet.addNotificationListener((n) => {
- if (
- n.type === NotificationType.WithdrawGroupFinished &&
- n.withdrawalSource.type === WithdrawalSourceType.Reserve &&
- n.withdrawalSource.reservePub === reservePub
- ) {
- resolve();
- }
- });
- });
-
- await bank.createReserve(bankUser, amount, reservePub, exchangePaytoUri);
- await donePromise;
-}