2017-04-20 03:09:25 +02:00
|
|
|
import {test, TestLib} from "talertest";
|
2016-11-14 01:29:08 +01:00
|
|
|
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();
|
|
|
|
});
|