2017-05-27 19:20:27 +02:00
|
|
|
import {test} from "ava";
|
2016-11-14 01:29:08 +01:00
|
|
|
import * as helpers from "./helpers";
|
|
|
|
|
|
|
|
|
2017-05-27 19:20:27 +02:00
|
|
|
test("URL canonicalization", t => {
|
2016-11-14 01:29:08 +01:00
|
|
|
// converts to relative, adds https
|
2017-05-27 19:20:27 +02:00
|
|
|
t.is(
|
2016-11-14 01:29:08 +01:00
|
|
|
"https://alice.example.com/exchange/",
|
2017-05-27 19:20:27 +02:00
|
|
|
helpers.canonicalizeBaseUrl("alice.example.com/exchange"));
|
2016-11-14 01:29:08 +01:00
|
|
|
|
|
|
|
// keeps http, adds trailing slash
|
2017-05-27 19:20:27 +02:00
|
|
|
t.is(
|
2016-11-14 01:29:08 +01:00
|
|
|
"http://alice.example.com/exchange/",
|
2017-05-27 19:20:27 +02:00
|
|
|
helpers.canonicalizeBaseUrl("http://alice.example.com/exchange"));
|
2016-11-14 01:29:08 +01:00
|
|
|
|
|
|
|
// keeps http, adds trailing slash
|
2017-05-27 19:20:27 +02:00
|
|
|
t.is(
|
2016-11-14 01:29:08 +01:00
|
|
|
"http://alice.example.com/exchange/",
|
2017-05-27 19:20:27 +02:00
|
|
|
helpers.canonicalizeBaseUrl("http://alice.example.com/exchange#foobar"));
|
2016-11-14 01:29:08 +01:00
|
|
|
t.pass();
|
|
|
|
});
|