UNPKG

1.99 kBJavaScriptView Raw
1import { deepStrictEqual } from "assert";
2import { parseDomain } from "./main";
3export const runSmokeTest = () => {
4 deepStrictEqual(parseDomain("www.example.com"), {
5 hostname: "www.example.com",
6 type: "LISTED",
7 labels: ["www", "example", "com"],
8 subDomains: ["www"],
9 domain: "example",
10 topLevelDomains: ["com"],
11 icann: {
12 subDomains: ["www"],
13 domain: "example",
14 topLevelDomains: ["com"],
15 },
16 });
17 deepStrictEqual(parseDomain("www.example.co.uk"), {
18 hostname: "www.example.co.uk",
19 type: "LISTED",
20 labels: ["www", "example", "co", "uk"],
21 subDomains: ["www"],
22 domain: "example",
23 topLevelDomains: ["co", "uk"],
24 icann: {
25 subDomains: ["www"],
26 domain: "example",
27 topLevelDomains: ["co", "uk"],
28 },
29 });
30 deepStrictEqual(parseDomain("www.example.cloudfront.net"), {
31 hostname: "www.example.cloudfront.net",
32 type: "LISTED",
33 labels: ["www", "example", "cloudfront", "net"],
34 subDomains: ["www"],
35 domain: "example",
36 topLevelDomains: ["cloudfront", "net"],
37 icann: {
38 subDomains: ["www", "example"],
39 domain: "cloudfront",
40 topLevelDomains: ["net"],
41 },
42 });
43 // TODO: Use fromUrl once we dropped Node v8 support
44 // deepStrictEqual(parseDomain(fromUrl("www.食狮.公司.cn")), {
45 deepStrictEqual(parseDomain("www.xn--85x722f.xn--55qx5d.cn"), {
46 hostname: "www.xn--85x722f.xn--55qx5d.cn",
47 type: "LISTED",
48 labels: ["www", "xn--85x722f", "xn--55qx5d", "cn"],
49 subDomains: ["www"],
50 domain: "xn--85x722f",
51 topLevelDomains: ["xn--55qx5d", "cn"],
52 icann: {
53 subDomains: ["www"],
54 domain: "xn--85x722f",
55 topLevelDomains: ["xn--55qx5d", "cn"],
56 },
57 });
58};
59//# sourceMappingURL=smoke-test.js.map
\No newline at end of file