aboutsummaryrefslogtreecommitdiff
path: root/src/taleruri-test.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-10-01 20:45:36 +0200
committerFlorian Dold <florian.dold@gmail.com>2019-10-01 20:46:22 +0200
commit1a23fbcb4fdad661feb9ea923761f7e02d7f6e8d (patch)
treeb34c72c43f69cd755b1aa5acff8a52345628bd3e /src/taleruri-test.ts
parent831d27c4df6412a6e1920341cbe6770a994a5804 (diff)
adapt to instance changes
Diffstat (limited to 'src/taleruri-test.ts')
-rw-r--r--src/taleruri-test.ts31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/taleruri-test.ts b/src/taleruri-test.ts
index 27cd7d18b..8b5828b7f 100644
--- a/src/taleruri-test.ts
+++ b/src/taleruri-test.ts
@@ -53,7 +53,7 @@ test("taler pay url parsing: defaults", (t) => {
t.fail();
return;
}
- t.is(r1.downloadUrl, "https://example.com/public/proposal?instance=default&order_id=myorder");
+ t.is(r1.downloadUrl, "https://example.com/public/proposal?order_id=myorder");
t.is(r1.sessionId, undefined);
const url2 = "taler://pay/example.com/-/-/myorder/mysession";
@@ -62,7 +62,7 @@ test("taler pay url parsing: defaults", (t) => {
t.fail();
return;
}
- t.is(r2.downloadUrl, "https://example.com/public/proposal?instance=default&order_id=myorder");
+ t.is(r2.downloadUrl, "https://example.com/public/proposal?order_id=myorder");
t.is(r2.sessionId, "mysession");
});
@@ -74,10 +74,33 @@ test("taler pay url parsing: trailing parts", (t) => {
t.fail();
return;
}
- t.is(r1.downloadUrl, "https://example.com/public/proposal?instance=default&order_id=myorder");
+ t.is(r1.downloadUrl, "https://example.com/public/proposal?order_id=myorder");
t.is(r1.sessionId, "mysession");
});
+
+test("taler pay url parsing: instance", (t) => {
+ const url1 = "taler://pay/example.com/-/myinst/myorder";
+ const r1 = parsePayUri(url1);
+ if (!r1) {
+ t.fail();
+ return;
+ }
+ t.is(r1.downloadUrl, "https://example.com/instances/myinst/public/proposal?order_id=myorder");
+});
+
+
+test("taler pay url parsing: path prefix and instance", (t) => {
+ const url1 = "taler://pay/example.com/mypfx/myinst/myorder";
+ const r1 = parsePayUri(url1);
+ if (!r1) {
+ t.fail();
+ return;
+ }
+ t.is(r1.downloadUrl, "https://example.com/mypfx/instances/myinst/public/proposal?order_id=myorder");
+});
+
+
test("taler withdraw uri parsing", (t) => {
const url1 = "taler://withdraw/bank.example.com/-/12345";
const r1 = parseWithdrawUri(url1);
@@ -86,4 +109,4 @@ test("taler withdraw uri parsing", (t) => {
return;
}
t.is(r1.statusUrl, "https://bank.example.com/api/withdraw-operation/12345");
-}); \ No newline at end of file
+});