commit e72e8e786467ff9e02e1983ab1fafa3acd4a1856
parent e9193c4708b3aee54457278cf19b5840e4d8b3d5
Author: Florian Dold <dold@taler.net>
Date: Tue, 21 Jul 2026 03:04:10 +0200
util: test that the AML statistics counter decodes the event field
Diffstat:
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/packages/taler-util/src/types-taler-exchange.test.ts b/packages/taler-util/src/types-taler-exchange.test.ts
@@ -16,7 +16,10 @@
import { test } from "node:test";
import assert from "node:assert";
-import { codecForExchangeKeysResponse } from "./types-taler-exchange.js";
+import {
+ codecForEventCounter,
+ codecForExchangeKeysResponse,
+} from "./types-taler-exchange.js";
/**
* A /keys response captured from a live exchange (protocol 37:0:3), reduced
@@ -237,3 +240,10 @@ test("codecForExchangeKeysResponse rejects tampered fields", (t) => {
);
assert.throws(mutate((k) => (k.stefan_lin = "not a number")));
});
+
+test("codecForEventCounter decodes the wire field 'event'", (t) => {
+ // The AML KYC-statistics response packs the statistic name as "event".
+ const decoded = codecForEventCounter().decode({ event: "foo", counter: 3 });
+ assert.strictEqual((decoded as any).event, "foo");
+ assert.strictEqual(decoded.counter, 3);
+});