taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit f6dfe4ce296e0cee3fa2f319eedbd695f6fc2320
parent 52abcdb8ac02a1921a5beb5c306189123ed63643
Author: Florian Dold <dold@taler.net>
Date:   Tue, 21 Jul 2026 10:52:04 +0200

util: test case-insensitive payto scheme and target type

Diffstat:
Mpackages/taler-util/src/payto.test.ts | 21+++++++++++++++++++++
1 file changed, 21 insertions(+), 0 deletions(-)

diff --git a/packages/taler-util/src/payto.test.ts b/packages/taler-util/src/payto.test.ts @@ -298,3 +298,24 @@ test("addPaytoQueryParams rejects a non-payto input", (t) => { addPaytoQueryParams("https://evil.com/x", { message: "hi" }), ); }); + +test("payto scheme and target type are case insensitive", (t) => { + // The C reference compares the prefix with strncasecmp and the target type + // with strcasecmp, so a URI the exchange accepts must parse here too. + const canonical = Paytos.toNormalizedString( + Result.unpack(Paytos.fromString("payto://iban/DE75512108001245126199")), + ); + for (const variant of [ + "PAYTO://iban/DE75512108001245126199", + "payto://IBAN/DE75512108001245126199", + "payto://Iban/DE75512108001245126199", + ]) { + const r = Paytos.fromString(variant); + assert.strictEqual(r.tag, "ok", variant); + assert.strictEqual( + Paytos.toNormalizedString(Result.unpack(r)), + canonical, + variant, + ); + } +});