Skip to content

Commit

Permalink
test: πŸ’ ipv4/ipv6 unit tests
Browse files Browse the repository at this point in the history
Extend upon existing IP validator unit test, valid examples. Provide
IPv6 test addresses including `%`.

βœ… Closes: #1626
  • Loading branch information
Ognjen Jevremovic committed Mar 19, 2021
1 parent 44eb7b8 commit 89f77ae
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,7 @@ describe('Validators', () => {
'1.2.3.4',
'::1',
'2001:db8:0000:1:1:1:1:1',
'2001:db8:3:4::192.0.2.33',
'2001:41d0:2:a141::1',
'::ffff:127.0.0.1',
'::0000',
Expand All @@ -779,8 +780,33 @@ describe('Validators', () => {
'1111:1:1:1:1:1:1:1',
'fe80::a6db:30ff:fe98:e946',
'::',
'::8',
'::ffff:127.0.0.1',
'::ffff:255.255.255.255',
'::ffff:0:255.255.255.255',
'::2:3:4:5:6:7:8',
'::255.255.255.255',
'0:0:0:0:0:ffff:127.0.0.1',
'1:2:3:4:5:6:7::',
'1:2:3:4:5:6::8',
'1::7:8',
'1:2:3:4:5::7:8',
'1:2:3:4:5::8',
'1::6:7:8',
'1:2:3:4::6:7:8',
'1:2:3:4::8',
'1::5:6:7:8',
'1:2:3::5:6:7:8',
'1:2:3::8',
'1::4:5:6:7:8',
'1:2::4:5:6:7:8',
'1:2::8',
'1::3:4:5:6:7:8',
'1::8',
'fe80::7:8%eth0',
'fe80::7:8%1',
'64:ff9b::192.0.2.33',
'0:0:0:0:0:0:10.0.0.1',
],
invalid: [
'abc',
Expand Down

0 comments on commit 89f77ae

Please sign in to comment.