blob: 4e9b994d66a7faffd93a57c9548d50a8c4bfaa9e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import {test} from "ava";
import * as helpers from "./helpers";
test("URL canonicalization", t => {
// converts to relative, adds https
t.is(
"https://alice.example.com/exchange/",
helpers.canonicalizeBaseUrl("alice.example.com/exchange"));
// keeps http, adds trailing slash
t.is(
"http://alice.example.com/exchange/",
helpers.canonicalizeBaseUrl("http://alice.example.com/exchange"));
// keeps http, adds trailing slash
t.is(
"http://alice.example.com/exchange/",
helpers.canonicalizeBaseUrl("http://alice.example.com/exchange#foobar"));
t.pass();
});
|