aboutsummaryrefslogtreecommitdiff
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.ts72
1 files changed, 20 insertions, 52 deletions
diff --git a/packages/taler-util/src/taleruri.test.ts b/packages/taler-util/src/taleruri.test.ts
index 1f0c37004..208beebbb 100644
--- a/packages/taler-util/src/taleruri.test.ts
+++ b/packages/taler-util/src/taleruri.test.ts
@@ -43,10 +43,9 @@ import {
} from "./taleruri.js";
import { AmountString } from "./taler-types.js";
-
/**
* 5.1 action: withdraw https://lsd.gnunet.org/lsd0006/#name-action-withdraw
- */
+ */
test("taler withdraw uri parsing", (t) => {
const url1 = "taler://withdraw/bank.example.com/12345";
@@ -73,18 +72,14 @@ test("taler withdraw uri parsing (http)", (t) => {
test("taler withdraw URI (stringify)", (t) => {
const url = stringifyWithdrawUri({
bankIntegrationApiBaseUrl: "https://bank.taler.test/integration-api/",
- withdrawalOperationId: "123"
+ withdrawalOperationId: "123",
});
- t.deepEqual(
- url,
- "taler://withdraw/bank.taler.test/integration-api/123",
- );
+ t.deepEqual(url, "taler://withdraw/bank.taler.test/integration-api/123");
});
-
/**
* 5.2 action: pay https://lsd.gnunet.org/lsd0006/#name-action-pay
- */
+ */
test("taler pay url parsing: defaults", (t) => {
const url1 = "taler://pay/example.com/myorder/";
const r1 = parsePayUri(url1);
@@ -197,7 +192,6 @@ test("taler refund uri parsing: non-https #1", (t) => {
t.is(r1.orderId, "myorder");
});
-
test("taler refund uri parsing", (t) => {
const url1 = "taler://refund/merchant.example.com/1234/";
const r1 = parseRefundUri(url1);
@@ -223,20 +217,15 @@ test("taler refund uri parsing with instance", (t) => {
test("taler refund URI (stringify)", (t) => {
const url = stringifyRefundUri({
merchantBaseUrl: "https://merchant.test/instance/pepe/",
- orderId:"123"
+ orderId: "123",
});
- t.deepEqual(
- url,
- "taler://refund/merchant.test/instance/pepe/123/",
- );
+ t.deepEqual(url, "taler://refund/merchant.test/instance/pepe/123/");
});
-
/**
* 5.4 action: reward https://lsd.gnunet.org/lsd0006/#name-action-tip
*/
-
test("taler reward pickup uri", (t) => {
const url1 = "taler://reward/merchant.example.com/tipid";
const r1 = parseRewardUri(url1);
@@ -272,15 +261,11 @@ test("taler reward pickup uri with instance and prefix", (t) => {
test("taler reward URI (stringify)", (t) => {
const url = stringifyRewardUri({
merchantBaseUrl: "https://merchant.test/instance/pepe/",
- merchantRewardId: "123"
+ merchantRewardId: "123",
});
- t.deepEqual(
- url,
- "taler://reward/merchant.test/instance/pepe/123/",
- );
+ t.deepEqual(url, "taler://reward/merchant.test/instance/pepe/123/");
});
-
/**
* 5.5 action: pay-push https://lsd.gnunet.org/lsd0006/#name-action-pay-push
*/
@@ -326,7 +311,6 @@ test("taler peer to peer push URI (stringify)", (t) => {
t.deepEqual(url, "taler://pay-push/foo.example.com/bla/123");
});
-
/**
* 5.6 action: pay-pull https://lsd.gnunet.org/lsd0006/#name-action-pay-pull
*/
@@ -372,13 +356,10 @@ test("taler peer to peer pull URI (stringify)", (t) => {
t.deepEqual(url, "taler://pay-pull/foo.example.com/bla/123");
});
-
-
/**
* 5.7 action: pay-template https://lsd.gnunet.org/lsd0006/#name-action-pay-template
*/
-
test("taler pay template URI (parsing)", (t) => {
const url1 =
"taler://pay-template/merchant.example.com/FEGHYJY48FEGU6WETYIOIDEDE2QW3OCZVY?amount=KUDOS:5";
@@ -410,20 +391,21 @@ test("taler pay template URI (stringify)", (t) => {
merchantBaseUrl: "http://merchant.example.com:1234/",
templateId: "FEGHYJY48FEGU6WETYIOIDEDE2QW3OCZVY",
templateParams: {
- amount: "KUDOS:5"
+ amount: "KUDOS:5",
},
});
- t.deepEqual(url1, "taler+http://pay-template/merchant.example.com:1234/FEGHYJY48FEGU6WETYIOIDEDE2QW3OCZVY?amount=KUDOS%3A5");
+ t.deepEqual(
+ url1,
+ "taler+http://pay-template/merchant.example.com:1234/FEGHYJY48FEGU6WETYIOIDEDE2QW3OCZVY?amount=KUDOS%3A5",
+ );
});
-
/**
* 5.8 action: exchange https://lsd.gnunet.org/lsd0006/#name-action-exchange
*/
test("taler exchange URI (parsing)", (t) => {
- const url1 =
- "taler://exchange/exchange.test/123";
+ const url1 = "taler://exchange/exchange.test/123";
const r1 = parseExchangeUri(url1);
if (!r1) {
t.fail();
@@ -436,21 +418,17 @@ test("taler exchange URI (parsing)", (t) => {
test("taler exchange URI (stringify)", (t) => {
const url1 = stringifyExchangeUri({
exchangeBaseUrl: "https://exchange.test",
- exchangePub: "123"
+ exchangePub: "123",
});
t.deepEqual(url1, "taler://exchange/exchange.test/123");
});
-
/**
* 5.9 action: auditor https://lsd.gnunet.org/lsd0006/#name-action-auditor
*/
-
-
test("taler auditor URI (parsing)", (t) => {
- const url1 =
- "taler://auditor/auditor.test/123";
+ const url1 = "taler://auditor/auditor.test/123";
const r1 = parseAuditorUri(url1);
if (!r1) {
t.fail();
@@ -463,12 +441,12 @@ test("taler auditor URI (parsing)", (t) => {
test("taler auditor URI (stringify)", (t) => {
const url1 = stringifyAuditorUri({
auditorBaseUrl: "https://auditor.test",
- auditorPub: "123"
+ auditorPub: "123",
});
t.deepEqual(url1, "taler://auditor/auditor.test/123");
});
-/**
+/**
* 5.10 action: restore https://lsd.gnunet.org/lsd0006/#name-action-restore
*/
test("taler restore URI (parsing, http with port)", (t) => {
@@ -513,15 +491,12 @@ test("taler restore URI (stringify)", (t) => {
);
});
-
-
/**
* 5.11 action: dev-experiment https://lsd.gnunet.org/lsd0006/#name-action-dev-experiment
*/
test("taler dev exp URI (parsing)", (t) => {
- const url1 =
- "taler://dev-experiment/123";
+ const url1 = "taler://dev-experiment/123";
const r1 = parseDevExperimentUri(url1);
if (!r1) {
t.fail();
@@ -532,12 +507,11 @@ test("taler dev exp URI (parsing)", (t) => {
test("taler dev exp URI (stringify)", (t) => {
const url1 = stringifyDevExperimentUri({
- devExperimentId: "123"
+ devExperimentId: "123",
});
t.deepEqual(url1, "taler://dev-experiment/123");
});
-
/**
* 5.12 action: withdraw-exchange https://lsd.gnunet.org/lsd0006/#name-action-withdraw-exchange
*/
@@ -581,7 +555,6 @@ test("taler withdraw exchange URI with amount (stringify)", (t) => {
);
});
-
/**
* wrong uris
*/
@@ -594,8 +567,3 @@ test("taler pay url parsing: wrong scheme", (t) => {
const r2 = parsePayUri(url2);
t.is(r2, undefined);
});
-
-
-
-
-