Skip to content

Commit 25d1971

Browse files
committed
Added tests for parsing of link-local IPv6 addresses
1 parent c1a5bd1 commit 25d1971

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

test/internal/url-util.test.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ describe('url', () => {
8383
host: '2a05:d018:270:f400:6d8c:d425:c5f:97f3',
8484
ipv6: true
8585
});
86+
87+
verifyUrl('[fe80::1%lo0]', {
88+
host: 'fe80::1%lo0',
89+
ipv6: true
90+
});
8691
});
8792

8893
it('should parse URL with host name and query', () => {
@@ -159,6 +164,12 @@ describe('url', () => {
159164
query: {animal: 'apa'},
160165
ipv6: true
161166
});
167+
168+
verifyUrl('[fe80::1%lo0]?animal=apa', {
169+
host: 'fe80::1%lo0',
170+
query: {animal: 'apa'},
171+
ipv6: true
172+
});
162173
});
163174

164175
it('should parse URL with scheme, host name and query', () => {
@@ -248,6 +259,13 @@ describe('url', () => {
248259
query: {animal: 'apa'},
249260
ipv6: true
250261
});
262+
263+
verifyUrl('bolt+routing://[fe80::1%lo0]?animal=apa', {
264+
scheme: 'bolt+routing',
265+
host: 'fe80::1%lo0',
266+
query: {animal: 'apa'},
267+
ipv6: true
268+
});
251269
});
252270

253271
it('should parse URL with host name and port', () => {
@@ -324,6 +342,12 @@ describe('url', () => {
324342
port: 7475,
325343
ipv6: true
326344
});
345+
346+
verifyUrl('[fe80::1%lo0]:7475', {
347+
host: 'fe80::1%lo0',
348+
port: 7475,
349+
ipv6: true
350+
});
327351
});
328352

329353
it('should parse URL with scheme and host name', () => {
@@ -400,6 +424,12 @@ describe('url', () => {
400424
host: '2a05:d018:270:f400:6d8c:d425:c5f:97f3',
401425
ipv6: true
402426
});
427+
428+
verifyUrl('bolt+routing://[fe80::1%lo0]', {
429+
scheme: 'bolt+routing',
430+
host: 'fe80::1%lo0',
431+
ipv6: true
432+
});
403433
});
404434

405435
it('should parse URL with scheme, host name and port', () => {
@@ -489,6 +519,13 @@ describe('url', () => {
489519
port: 22,
490520
ipv6: true
491521
});
522+
523+
verifyUrl('wss://[fe80::1%lo0]:22', {
524+
scheme: 'wss',
525+
host: 'fe80::1%lo0',
526+
port: 22,
527+
ipv6: true
528+
});
492529
});
493530

494531
it('should parse URL with scheme, host name, port and query', () => {
@@ -591,6 +628,14 @@ describe('url', () => {
591628
query: {key1: 'value1', key2: 'value2'},
592629
ipv6: true
593630
});
631+
632+
verifyUrl('https://[fe80::1%lo0]:4242?key1=value1', {
633+
scheme: 'https',
634+
host: 'fe80::1%lo0',
635+
port: 4242,
636+
query: {key1: 'value1'},
637+
ipv6: true
638+
});
594639
});
595640

596641
it('should fail to parse URL without host', () => {

0 commit comments

Comments
 (0)