#71 Add unit test for the TLD+1 module, Replace our implementations with functions like normlize
Opened 2 years ago by polcak. Modified 7 months ago

nscl/common/tld.js provides very useful processing. We should use the module and we need to test that everything in the module works.

Add test cases like

for (d of ["www.fit.vutbr.cz","www.fit.vutbr.cz.", "[::]", "127.0.0.1", "polcak.github.io", "www.háčkyčárky.cz", "xn--wkd-8cdx9d7hbd.org"]) {
  console.log(d);
  console.log(tld.getDomain(d));
  console.log(tld.getPublicSuffix(d));
  console.log(tld.normalize(d));
  console.log(tld.isIp(d));
}
www.fit.vutbr.cz
vutbr.cz
cz
www.fit.vutbr.cz
false
www.fit.vutbr.cz.
vutbr.cz
cz
www.fit.vutbr.cz
false
[::]
[::]
undefined
[::]
true
127.0.0.1
127.0.0.1
undefined
127.0.0.1
true
polcak.github.io
polcak.github.io
github.io
polcak.github.io
false
www.háčkyčárky.cz
háčkyčárky.cz
cz
www.háčkyčárky.cz
false
xn--wkd-8cdx9d7hbd.org
xn--wkd-8cdx9d7hbd.org
org
xn--wkd-8cdx9d7hbd.org
false

Metadata Update from @polcak:
- Issue tagged with: tests

2 years ago

Login to comment on this ticket.

Metadata