diff options
Diffstat (limited to 'packages/taler-util/src/taleruri.test.ts')
-rw-r--r-- | packages/taler-util/src/taleruri.test.ts | 52 |
1 files changed, 18 insertions, 34 deletions
diff --git a/packages/taler-util/src/taleruri.test.ts b/packages/taler-util/src/taleruri.test.ts index 7f10d21fd..b751efa34 100644 --- a/packages/taler-util/src/taleruri.test.ts +++ b/packages/taler-util/src/taleruri.test.ts @@ -423,24 +423,27 @@ test("taler dev exp URI (stringify)", (t) => { */ test("taler withdraw exchange URI (parse)", (t) => { + // Pubkey has been phased out, may no longer be specified. { - const r1 = parseWithdrawExchangeUri( + const rx1 = parseWithdrawExchangeUri( "taler://withdraw-exchange/exchange.demo.taler.net/someroot/GJKG23V4ZBHEH45YRK7TWQE8ZTY7JWTY5094TQJSRZN5DSDBX8E0?a=KUDOS%3A2", ); - if (!r1) { + if (rx1) { t.fail(); return; } - t.deepEqual( - r1.exchangePub, - "GJKG23V4ZBHEH45YRK7TWQE8ZTY7JWTY5094TQJSRZN5DSDBX8E0", - ); - t.deepEqual( - r1.exchangeBaseUrl, - "https://exchange.demo.taler.net/someroot/", + } + { + const rx2 = parseWithdrawExchangeUri( + "taler://withdraw-exchange/exchange.demo.taler.net/GJKG23V4ZBHEH45YRK7TWQE8ZTY7JWTY5094TQJSRZN5DSDBX8E0", ); - t.deepEqual(r1.amount, "KUDOS:2"); + if (rx2) { + t.fail(); + return; + } } + + // Now test well-formed URIs { const r2 = parseWithdrawExchangeUri( "taler://withdraw-exchange/exchange.demo.taler.net/someroot/", @@ -449,7 +452,6 @@ test("taler withdraw exchange URI (parse)", (t) => { t.fail(); return; } - t.deepEqual(r2.exchangePub, undefined); t.deepEqual(r2.amount, undefined); t.deepEqual( r2.exchangeBaseUrl, @@ -465,7 +467,6 @@ test("taler withdraw exchange URI (parse)", (t) => { t.fail(); return; } - t.deepEqual(r3.exchangePub, undefined); t.deepEqual(r3.amount, undefined); t.deepEqual(r3.exchangeBaseUrl, "https://exchange.demo.taler.net/"); } @@ -479,7 +480,6 @@ test("taler withdraw exchange URI (parse)", (t) => { t.fail(); return; } - t.deepEqual(r4.exchangePub, undefined); t.deepEqual(r4.amount, undefined); t.deepEqual(r4.exchangeBaseUrl, "https://exchange.demo.taler.net/"); } @@ -488,27 +488,21 @@ test("taler withdraw exchange URI (parse)", (t) => { test("taler withdraw exchange URI (stringify)", (t) => { const url = stringifyWithdrawExchange({ exchangeBaseUrl: "https://exchange.demo.taler.net", - exchangePub: "GJKG23V4ZBHEH45YRK7TWQE8ZTY7JWTY5094TQJSRZN5DSDBX8E0", }); - t.deepEqual( - url, - "taler://withdraw-exchange/exchange.demo.taler.net/GJKG23V4ZBHEH45YRK7TWQE8ZTY7JWTY5094TQJSRZN5DSDBX8E0", - ); + t.deepEqual(url, "taler://withdraw-exchange/exchange.demo.taler.net/"); }); test("taler withdraw exchange URI with amount (stringify)", (t) => { const url = stringifyWithdrawExchange({ exchangeBaseUrl: "https://exchange.demo.taler.net", - exchangePub: "GJKG23V4ZBHEH45YRK7TWQE8ZTY7JWTY5094TQJSRZN5DSDBX8E0", amount: "KUDOS:19" as AmountString, }); t.deepEqual( url, - "taler://withdraw-exchange/exchange.demo.taler.net/GJKG23V4ZBHEH45YRK7TWQE8ZTY7JWTY5094TQJSRZN5DSDBX8E0?a=KUDOS%3A19", + "taler://withdraw-exchange/exchange.demo.taler.net/?a=KUDOS%3A19", ); }); - /** * 5.13 action: add-exchange https://lsd.gnunet.org/lsd0006/#name-action-add-exchange */ @@ -522,10 +516,7 @@ test("taler add exchange URI (parse)", (t) => { t.fail(); return; } - t.deepEqual( - r1.exchangeBaseUrl, - "https://exchange.example.com/", - ); + t.deepEqual(r1.exchangeBaseUrl, "https://exchange.example.com/"); } { const r2 = parseAddExchangeUri( @@ -535,22 +526,15 @@ test("taler add exchange URI (parse)", (t) => { t.fail(); return; } - t.deepEqual( - r2.exchangeBaseUrl, - "https://exchanges.example.com/api/", - ); + 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/", - ); + t.deepEqual(url, "taler://add-exchange/exchange.demo.taler.net/"); }); /** |