summaryrefslogtreecommitdiff
path: root/packages/taler-util/src/taleruri.test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-util/src/taleruri.test.ts')
-rw-r--r--packages/taler-util/src/taleruri.test.ts47
1 files changed, 47 insertions, 0 deletions
diff --git a/packages/taler-util/src/taleruri.test.ts b/packages/taler-util/src/taleruri.test.ts
index dbd175fe5..7f10d21fd 100644
--- a/packages/taler-util/src/taleruri.test.ts
+++ b/packages/taler-util/src/taleruri.test.ts
@@ -17,6 +17,7 @@
import test from "ava";
import { AmountString } from "./taler-types.js";
import {
+ parseAddExchangeUri,
parseDevExperimentUri,
parsePayPullUri,
parsePayPushUri,
@@ -26,6 +27,7 @@ import {
parseRestoreUri,
parseWithdrawExchangeUri,
parseWithdrawUri,
+ stringifyAddExchange,
stringifyDevExperimentUri,
stringifyPayPullUri,
stringifyPayPushUri,
@@ -506,6 +508,51 @@ test("taler withdraw exchange URI with amount (stringify)", (t) => {
);
});
+
+/**
+ * 5.13 action: add-exchange https://lsd.gnunet.org/lsd0006/#name-action-add-exchange
+ */
+
+test("taler add exchange URI (parse)", (t) => {
+ {
+ const r1 = parseAddExchangeUri(
+ "taler://add-exchange/exchange.example.com/",
+ );
+ if (!r1) {
+ t.fail();
+ return;
+ }
+ t.deepEqual(
+ r1.exchangeBaseUrl,
+ "https://exchange.example.com/",
+ );
+ }
+ {
+ const r2 = parseAddExchangeUri(
+ "taler://add-exchange/exchanges.example.com/api/",
+ );
+ if (!r2) {
+ t.fail();
+ return;
+ }
+ t.deepEqual(
+ r2.exchangeBaseUrl,
+ "https://exchanges.example.com/api/",
+ );
+ }
+
+});
+
+test("taler add exchange URI (stringify)", (t) => {
+ const url = stringifyAddExchange({
+ exchangeBaseUrl: "https://exchange.demo.taler.net",
+ });
+ t.deepEqual(
+ url,
+ "taler://add-exchange/exchange.demo.taler.net/",
+ );
+});
+
/**
* wrong uris
*/