wallet-core/src/helpers-test.ts

22 lines
596 B
TypeScript
Raw Normal View History

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