|
1 | 1 | import * as assert from 'assert/strict'; |
2 | | -import {arePathsEqual, trimHash, trimSearch, trimSearchAndHash} from '@src/utils/url'; |
| 2 | +import {trimHash, trimSearch, trimSearchAndHash} from '@src/utils/url'; |
3 | 3 |
|
4 | 4 | describe('trimSearch', function () { |
5 | 5 | it('removes the query parameters from a URL', function () { |
@@ -27,68 +27,3 @@ describe('trimSearchAndHash', function () { |
27 | 27 | assert.equal(trimSearchAndHash(parsedUrl).toString(), 'https://example.com/path'); |
28 | 28 | }); |
29 | 29 | }); |
30 | | - |
31 | | -describe('arePathsEqual', function () { |
32 | | - it('returns false if one of the param is not a URL', function () { |
33 | | - const url1 = 'foo'; |
34 | | - const url2 = 'https://example.com'; |
35 | | - |
36 | | - assert.equal(arePathsEqual(url1, url2), false); |
37 | | - }); |
38 | | - |
39 | | - it('returns false if hostnames are different', function () { |
40 | | - const url1 = 'https://a.com'; |
41 | | - const url2 = 'https://b.com'; |
42 | | - |
43 | | - assert.equal(arePathsEqual(url1, url2), false); |
44 | | - }); |
45 | | - |
46 | | - it('returns false if top level domains are different', function () { |
47 | | - const url1 = 'https://a.io'; |
48 | | - const url2 = 'https://a.com'; |
49 | | - |
50 | | - assert.equal(arePathsEqual(url1, url2), false); |
51 | | - }); |
52 | | - |
53 | | - it('returns false if sub domains are different', function () { |
54 | | - const url1 = 'https://sub.a.com'; |
55 | | - const url2 = 'https://subdiff.a.com'; |
56 | | - |
57 | | - assert.equal(arePathsEqual(url1, url2), false); |
58 | | - }); |
59 | | - |
60 | | - it('returns false if paths are different', function () { |
61 | | - const url1 = 'https://a.com/path-1'; |
62 | | - const url2 = 'https://a.com/path-2'; |
63 | | - |
64 | | - assert.equal(arePathsEqual(url1, url2), false); |
65 | | - }); |
66 | | - |
67 | | - it('returns true even if protocols are different', function () { |
68 | | - const url1 = 'http://a.com'; |
69 | | - const url2 = 'https://a.com'; |
70 | | - |
71 | | - assert.equal(arePathsEqual(url1, url2), true); |
72 | | - }); |
73 | | - |
74 | | - it('returns true even if www is used in one of the urls', function () { |
75 | | - const url1 = 'https://www.a.com'; |
76 | | - const url2 = 'https://a.com'; |
77 | | - |
78 | | - assert.equal(arePathsEqual(url1, url2), true); |
79 | | - }); |
80 | | - |
81 | | - it('returns true even if query parameters are different', function () { |
82 | | - const url1 = 'http://a.com?foo=bar'; |
83 | | - const url2 = 'http://a.com'; |
84 | | - |
85 | | - assert.equal(arePathsEqual(url1, url2), true); |
86 | | - }); |
87 | | - |
88 | | - it('returns true even if hash segments are different', function () { |
89 | | - const url1 = 'http://a.com#segment-1'; |
90 | | - const url2 = 'http://a.com'; |
91 | | - |
92 | | - assert.equal(arePathsEqual(url1, url2), true); |
93 | | - }); |
94 | | -}); |
0 commit comments