summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-cli/src/integrationtests
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-cli/src/integrationtests')
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/helpers.ts17
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-revocation.ts21
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/testrunner.ts6
3 files changed, 33 insertions, 11 deletions
diff --git a/packages/taler-wallet-cli/src/integrationtests/helpers.ts b/packages/taler-wallet-cli/src/integrationtests/helpers.ts
index c51c306c9..f9051ccc0 100644
--- a/packages/taler-wallet-cli/src/integrationtests/helpers.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/helpers.ts
@@ -45,8 +45,11 @@ import {
ConfirmPayResultType,
ContractTerms,
} from "taler-wallet-core";
-import { FaultInjectedExchangeService, FaultInjectedMerchantService } from "./faultInjection";
-import { defaultCoinConfig } from "./denomStructures";
+import {
+ FaultInjectedExchangeService,
+ FaultInjectedMerchantService,
+} from "./faultInjection";
+import { CoinConfig, defaultCoinConfig } from "./denomStructures";
export interface SimpleTestEnvironment {
commonDb: DbInfo;
@@ -63,6 +66,7 @@ export interface SimpleTestEnvironment {
*/
export async function createSimpleTestkudosEnvironment(
t: GlobalTestState,
+ coinConfig: CoinConfig[] = defaultCoinConfig.map((x) => x("TESTKUDOS")),
): Promise<SimpleTestEnvironment> {
const db = await setupDb(t);
@@ -99,7 +103,7 @@ export async function createSimpleTestkudosEnvironment(
await bank.pingUntilAvailable();
- exchange.addOfferedCoins(defaultCoinConfig);
+ exchange.addCoinConfigList(coinConfig);
await exchange.start();
await exchange.pingUntilAvailable();
@@ -139,7 +143,7 @@ export interface FaultyMerchantTestEnvironment {
commonDb: DbInfo;
bank: BankService;
exchange: ExchangeService;
- faultyExchange: FaultInjectedExchangeService,
+ faultyExchange: FaultInjectedExchangeService;
exchangeBankAccount: ExchangeBankAccount;
merchant: MerchantService;
faultyMerchant: FaultInjectedMerchantService;
@@ -185,7 +189,10 @@ export async function createFaultInjectedMerchantTestkudosEnvironment(
);
exchange.addBankAccount("1", exchangeBankAccount);
- bank.setSuggestedExchange(faultyExchange, exchangeBankAccount.accountPaytoUri);
+ bank.setSuggestedExchange(
+ faultyExchange,
+ exchangeBankAccount.accountPaytoUri,
+ );
await bank.start();
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-revocation.ts b/packages/taler-wallet-cli/src/integrationtests/test-revocation.ts
index 0fcf7a932..de4086df9 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-revocation.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-revocation.ts
@@ -17,6 +17,7 @@
/**
* Imports.
*/
+import { CoinConfig } from "./denomStructures";
import {
GlobalTestState,
ExchangeService,
@@ -28,7 +29,6 @@ import {
withdrawViaBank,
makeTestPayment,
} from "./helpers";
-import { CoinDumpJson } from "taler-wallet-core";
async function revokeAllWalletCoins(req: {
wallet: WalletCli;
@@ -45,7 +45,9 @@ async function revokeAllWalletCoins(req: {
for (const x of usedDenomHashes.values()) {
await exchange.revokeDenomination(x);
}
-
+ await exchange.stop();
+ await exchange.start();
+ await exchange.pingUntilAvailable();
await exchange.keyup();
await exchange.pingUntilAvailable();
await merchant.stop();
@@ -59,12 +61,25 @@ async function revokeAllWalletCoins(req: {
export async function runRevocationTest(t: GlobalTestState) {
// Set up test environment
+ const coin_u1: CoinConfig = {
+ durationLegal: "3 years",
+ durationSpend: "2 years",
+ durationWithdraw: "7 days",
+ rsaKeySize: 1024,
+ name: `$TESTKUDOS_u1`,
+ value: `TESTKUDOS:1`,
+ feeDeposit: `TESTKUDOS:0`,
+ feeRefresh: `TESTKUDOS:0`,
+ feeRefund: `TESTKUDOS:0`,
+ feeWithdraw: `TESTKUDOS:0`,
+ };
+
const {
wallet,
bank,
exchange,
merchant,
- } = await createSimpleTestkudosEnvironment(t);
+ } = await createSimpleTestkudosEnvironment(t, [coin_u1]);
// Withdraw digital cash into the wallet.
diff --git a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts
index fbc25168e..2acec0627 100644
--- a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts
@@ -170,7 +170,7 @@ export async function runTests(spec: TestRunSpec) {
testRootDir,
};
- currentChild = child_process.fork(__filename, {
+ currentChild = child_process.fork(__filename, ["__TWCLI_TESTWORKER"], {
env: {
TWCLI_RUN_TEST_INSTRUCTION: JSON.stringify(testInstr),
...process.env,
@@ -251,9 +251,9 @@ export function getTestInfo(): TestInfo[] {
}
const runTestInstrStr = process.env["TWCLI_RUN_TEST_INSTRUCTION"];
-if (runTestInstrStr) {
+if (runTestInstrStr && process.argv.includes("__TWCLI_TESTWORKER")) {
// Test will call taler-wallet-cli, so we must not propagate this variable.
- delete process.env["TWCLI_RUN_TEST_NAME"];
+ delete process.env["TWCLI_RUN_TEST_INSTRUCTION"];
const { testRootDir, testName } = JSON.parse(
runTestInstrStr,
) as RunTestChildInstruction;