harness: check expected balance in test-pay-expired
This commit is contained in:
parent
a3f370b0d8
commit
49b0f5337c
@ -384,7 +384,11 @@ export class GlobalTestState {
|
||||
logger.warn(`could not start process (${command})`, err);
|
||||
});
|
||||
proc.on("exit", (code, signal) => {
|
||||
if (code == 0 && signal == null) {
|
||||
logger.info(`process ${logName} exited with success`);
|
||||
} else {
|
||||
logger.warn(`process ${logName} exited ${j2s({ code, signal })}`);
|
||||
}
|
||||
});
|
||||
const stderrLogFileName = this.testDir + `/${logName}-stderr.log`;
|
||||
const stderrLog = fs.createWriteStream(stderrLogFileName, {
|
||||
|
@ -624,7 +624,7 @@ export async function applyTimeTravelV2(
|
||||
}
|
||||
|
||||
if (s.walletClient) {
|
||||
s.walletClient.call(WalletApiOperation.TestingSetTimetravel, {
|
||||
await s.walletClient.call(WalletApiOperation.TestingSetTimetravel, {
|
||||
offsetMs: timetravelOffsetMs,
|
||||
});
|
||||
}
|
||||
|
@ -20,14 +20,17 @@
|
||||
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
|
||||
import { GlobalTestState, MerchantApiClient } from "../harness/harness.js";
|
||||
import {
|
||||
applyTimeTravelV2,
|
||||
createSimpleTestkudosEnvironmentV2,
|
||||
withdrawViaBankV2,
|
||||
} from "../harness/helpers.js";
|
||||
import {
|
||||
AbsoluteTime,
|
||||
ConfirmPayResultType,
|
||||
Duration,
|
||||
MerchantContractTerms,
|
||||
PreparePayResultType,
|
||||
j2s,
|
||||
} from "@gnu-taler/taler-util";
|
||||
|
||||
/**
|
||||
@ -95,6 +98,33 @@ export async function runPaymentExpiredTest(t: GlobalTestState) {
|
||||
preparePayResult.status,
|
||||
PreparePayResultType.PaymentPossible,
|
||||
);
|
||||
|
||||
await applyTimeTravelV2(
|
||||
Duration.toMilliseconds(Duration.fromSpec({ hours: 1 })),
|
||||
{ walletClient, exchange, merchant },
|
||||
);
|
||||
|
||||
const confirmPayResult = await walletClient.call(
|
||||
WalletApiOperation.ConfirmPay,
|
||||
{ transactionId: preparePayResult.transactionId },
|
||||
);
|
||||
console.log("confirm pay result:");
|
||||
console.log(j2s(confirmPayResult));
|
||||
t.assertDeepEqual(confirmPayResult.type, ConfirmPayResultType.Pending);
|
||||
await walletClient.call(WalletApiOperation.AbortTransaction, {
|
||||
transactionId: preparePayResult.transactionId,
|
||||
});
|
||||
await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {});
|
||||
|
||||
const bal = await walletClient.call(WalletApiOperation.GetBalances, {});
|
||||
console.log(bal);
|
||||
|
||||
t.assertAmountEquals(bal.balances[0].available, "TESTKUDOS:18.93");
|
||||
|
||||
const txns = await walletClient.call(WalletApiOperation.GetTransactions, {
|
||||
includeRefreshes: true,
|
||||
});
|
||||
console.log(j2s(txns));
|
||||
}
|
||||
|
||||
runPaymentExpiredTest.suites = ["wallet"];
|
||||
|
@ -65,6 +65,7 @@ export async function createRemoteWallet(
|
||||
const ctx: RemoteWallet = {
|
||||
makeCoreApiRequest(operation, payload) {
|
||||
const id = `req-${nextRequestId}`;
|
||||
nextRequestId += 1;
|
||||
const req: CoreApiRequestEnvelope = {
|
||||
operation,
|
||||
id,
|
||||
|
@ -1680,6 +1680,7 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>(
|
||||
const req = codecForTestingSetTimetravelRequest().decode(payload);
|
||||
setDangerousTimetravel(req.offsetMs);
|
||||
ws.workAvailable.trigger();
|
||||
return {};
|
||||
}
|
||||
// default:
|
||||
// assertUnreachable(operation);
|
||||
|
Loading…
Reference in New Issue
Block a user