Skip to content

Commit 25e6e22

Browse files
committed
test: update isSameHost tests
1 parent 33acfcc commit 25e6e22

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/__tests__/isSameHost.test.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ describe('isSameHost', () => {
1919
expect(
2020
isSameHost('https://example.com/', 'http://example.com/contact'),
2121
).toBe(true);
22+
expect(
23+
isSameHost('https://main.example.com:3000', 'https://main.example.com'),
24+
).toBe(true);
2225
});
2326

2427
it('should return true for URLs with and without www', () => {
@@ -28,11 +31,26 @@ describe('isSameHost', () => {
2831
expect(
2932
isSameHost('http://www.example.com/about', 'http://example.com/about'),
3033
).toBe(true);
34+
expect(
35+
isSameHost(
36+
'https://www.main.example.com/contact',
37+
'https://main.example.com',
38+
),
39+
);
3140
});
3241

3342
it('should return false for URLs with different hosts', () => {
3443
expect(
35-
isSameHost('https://example.com', 'https://anotherexample.com'),
44+
isSameHost(
45+
'http://example.com',
46+
'https://www.instagram.com/gamegatornet/',
47+
),
48+
).toBe(false);
49+
expect(
50+
isSameHost(
51+
'http://main.example.com',
52+
'https://www.instagram.com/gamegatornet/',
53+
),
3654
).toBe(false);
3755
expect(
3856
isSameHost('http://subdomain.example.com', 'http://example.com'),

0 commit comments

Comments
 (0)