mirror of
https://github.com/jakejarvis/rdapper.git
synced 2026-09-11 04:15:32 -04:00
Add additional synonyms for WHOIS normalization (fixes #10)
This commit is contained in:
@@ -105,6 +105,40 @@ Domain expires: 31-Jul-2026
|
||||
expect(rec.expirationDate).toBe("2026-07-31T00:00:00Z");
|
||||
});
|
||||
|
||||
test("WHOIS .it uses 'Expire Date' for expiration", () => {
|
||||
const text = `
|
||||
Domain: EXAMPLE.IT
|
||||
Registrar: Registrar S.p.A.
|
||||
Expire Date: 2026-01-20
|
||||
Last Update: 2025-01-10
|
||||
`;
|
||||
const rec = normalizeWhois("example.it", "it", text, "whois.nic.it");
|
||||
expect(rec.expirationDate).toBe("2026-01-20T00:00:00Z");
|
||||
});
|
||||
|
||||
test("WHOIS .cn uses 'Registration Time' and 'Expiration Time'", () => {
|
||||
const text = `
|
||||
Domain Name: example.cn
|
||||
ROID: 20200102s10001s00000000-cn
|
||||
Registration Time: 2020-01-02 03:04:05
|
||||
Expiration Time: 2031-01-02 03:04:05
|
||||
`;
|
||||
const rec = normalizeWhois("example.cn", "cn", text, "whois.cnnic.cn");
|
||||
expect(rec.creationDate).toBe("2020-01-02T03:04:05Z");
|
||||
expect(rec.expirationDate).toBe("2031-01-02T03:04:05Z");
|
||||
});
|
||||
|
||||
test("WHOIS with bare 'expires' key is recognized", () => {
|
||||
const text = `
|
||||
domain: example.in.ua
|
||||
created: 2020-01-02 03:04:05+03
|
||||
expires: 2030-01-02 03:04:05+03
|
||||
`;
|
||||
const rec = normalizeWhois("example.in.ua", "in.ua", text, "whois.in.ua");
|
||||
expect(Boolean(rec.expirationDate)).toBe(true);
|
||||
expect(rec.expirationDate).toBe("2030-01-02T00:04:05Z");
|
||||
});
|
||||
|
||||
test("Privacy redacted WHOIS normalizes without contacts", () => {
|
||||
const text = `
|
||||
Domain Name: EXAMPLE.COM
|
||||
|
||||
@@ -31,12 +31,15 @@ export function normalizeWhois(
|
||||
"domain create date",
|
||||
"created",
|
||||
"registered",
|
||||
// CNNIC (.cn)
|
||||
"registration time",
|
||||
// EDUCAUSE (.edu)
|
||||
"domain record activated",
|
||||
]);
|
||||
const updatedDate = anyValue(map, [
|
||||
"updated date",
|
||||
"last updated",
|
||||
"last update",
|
||||
"last modified",
|
||||
"modified",
|
||||
// EDUCAUSE (.edu)
|
||||
@@ -47,6 +50,10 @@ export function normalizeWhois(
|
||||
"registry expiration date",
|
||||
"expiry date",
|
||||
"expiration date",
|
||||
// ccTLDs like .it use "Expire Date"
|
||||
"expire date",
|
||||
// CNNIC (.cn)
|
||||
"expiration time",
|
||||
// Registrar-side synonyms commonly seen after referrals
|
||||
"registrar registration expiration date",
|
||||
"registrar registration expiry date",
|
||||
@@ -56,6 +63,8 @@ export function normalizeWhois(
|
||||
"domain expires",
|
||||
"paid-till",
|
||||
"expires on",
|
||||
// Some registries use a bare "expires" key
|
||||
"expires",
|
||||
"renewal date",
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user