aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMS <ms@taler.net>2022-12-17 00:26:02 +0100
committerMS <ms@taler.net>2022-12-17 00:26:02 +0100
commitd5efb6198ea6a5fc159c8d546a1af13ff3d301e9 (patch)
tree28a0246541732a1dae47e39d5e36a1b0130f515e
parent39b02d6878c91da0aa0809d57179779381656a3e (diff)
libeufin tests: adapt to new report/statement policy
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-libeufin-c5x.ts42
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-libeufin-nexus-balance.ts7
2 files changed, 31 insertions, 18 deletions
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-c5x.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-c5x.ts
index cc46c6d33..2ba29656a 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-c5x.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-c5x.ts
@@ -89,8 +89,6 @@ export async function runLibeufinC5xTest(t: GlobalTestState) {
"first payment",
);
- // Checking that C52 has one and C53 has zero.
-
let expectOne = await LibeufinNexusApi.fetchTransactions(
libeufinServices.libeufinNexus,
user01nexus.localAccountName,
@@ -100,22 +98,43 @@ export async function runLibeufinC5xTest(t: GlobalTestState) {
t.assertTrue(expectOne.data.newTransactions == 1);
t.assertTrue(expectOne.data.downloadedTransactions == 1);
+ /* Expect zero payments being downloaded because the
+ * previous request consumed already the one pending
+ * payment.
+ */
let expectZero = await LibeufinNexusApi.fetchTransactions(
libeufinServices.libeufinNexus,
user01nexus.localAccountName,
"all", // range
+ "report", // C52
+ );
+ t.assertTrue(expectZero.data.newTransactions == 0);
+ t.assertTrue(expectZero.data.downloadedTransactions == 0);
+
+ /**
+ * A statement should still account zero payments because
+ * so far the payment made before is still pending.
+ */
+ expectZero = await LibeufinNexusApi.fetchTransactions(
+ libeufinServices.libeufinNexus,
+ user01nexus.localAccountName,
+ "all", // range
"statement", // C53
);
t.assertTrue(expectZero.data.newTransactions == 0);
t.assertTrue(expectZero.data.downloadedTransactions == 0);
- // Ticking now: the one payment should be downloaded
- // in a C53 but not in a C52. In any case, the payment
- // is not new anymore, because it was already ingested
- // when it was downloaded for the first time along the
- // c52 above.
+ /**
+ * Ticking now. That books any pending transaction.
+ */
await libeufinServices.libeufinSandbox.c53tick();
+ /**
+ * A statement is now expected to download the transaction,
+ * although that got already ingested along the report
+ * earlier. Thus the transaction counts as downloaded but
+ * not as new.
+ */
expectOne = await LibeufinNexusApi.fetchTransactions(
libeufinServices.libeufinNexus,
user01nexus.localAccountName,
@@ -124,14 +143,5 @@ export async function runLibeufinC5xTest(t: GlobalTestState) {
);
t.assertTrue(expectOne.data.downloadedTransactions == 1);
t.assertTrue(expectOne.data.newTransactions == 0);
-
- expectZero = await LibeufinNexusApi.fetchTransactions(
- libeufinServices.libeufinNexus,
- user01nexus.localAccountName,
- "all", // range
- "report", // C52
- );
- t.assertTrue(expectZero.data.downloadedTransactions == 0);
- t.assertTrue(expectZero.data.newTransactions == 0);
}
runLibeufinC5xTest.suites = ["libeufin"];
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-nexus-balance.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-nexus-balance.ts
index b1ef53a79..850b0f1d9 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-nexus-balance.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-nexus-balance.ts
@@ -89,10 +89,13 @@ export async function runLibeufinNexusBalanceTest(t: GlobalTestState) {
);
t.assertAmountEquals(accountInfo.data.lastSeenBalance, "EUR:20");
+ // Booking the first two transactions.
+ await libeufinServices.libeufinSandbox.c53tick();
+
// user 01 gives 30
await libeufinServices.libeufinSandbox.makeTransaction(
- user01sandbox.ebicsBankAccount.label, // credit
- user02sandbox.ebicsBankAccount.label, // debit
+ user01sandbox.ebicsBankAccount.label,
+ user02sandbox.ebicsBankAccount.label,
"EUR:30",
"third payment",
);