aboutsummaryrefslogtreecommitdiff
path: root/src/helpers-test.ts
blob: d252e9720891d6baee909fc519adb60172ebe86c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import {test, TestLib} from "talertest";
import * as helpers from "./helpers";


test("URL canonicalization", (t: TestLib) => {
  // converts to relative, adds https
  t.assertEqualsStrict(
    "https://alice.example.com/exchange/",
    helpers.canonicalizeBaseUrl("alice.example.com/exchange"))

  // keeps http, adds trailing slash
  t.assertEqualsStrict(
    "http://alice.example.com/exchange/",
    helpers.canonicalizeBaseUrl("http://alice.example.com/exchange"))

  // keeps http, adds trailing slash
  t.assertEqualsStrict(
    "http://alice.example.com/exchange/",
    helpers.canonicalizeBaseUrl("http://alice.example.com/exchange#foobar"))
  t.pass();
});