2018-07-08 22:02:28 +07:00
|
|
|
import { DomainExtractor } from "./DomainExtractor";
|
2017-10-07 23:37:08 +07:00
|
|
|
import Assert = require("assert");
|
|
|
|
|
2018-07-08 22:02:28 +07:00
|
|
|
describe("utils/DomainExtractor", function () {
|
2017-10-07 23:37:08 +07:00
|
|
|
describe("test fromUrl", function () {
|
|
|
|
it("should return domain from https url", function () {
|
|
|
|
const domain = DomainExtractor.fromUrl("https://www.example.com/test/abc");
|
|
|
|
Assert.equal(domain, "www.example.com");
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should return domain from http url", function () {
|
|
|
|
const domain = DomainExtractor.fromUrl("http://www.example.com/test/abc");
|
|
|
|
Assert.equal(domain, "www.example.com");
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should return domain when url contains port", function () {
|
|
|
|
const domain = DomainExtractor.fromUrl("https://www.example.com:8080/test/abc");
|
|
|
|
Assert.equal(domain, "www.example.com");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|