mirror of
https://github.com/jakejarvis/rdapper.git
synced 2026-09-23 01:25:31 -04:00
Add support for custom fetch function and/or IANA bootstrap data (#21)
This commit is contained in:
@@ -30,6 +30,7 @@ describe("WHOIS coalescing", () => {
|
||||
expect(chain.length).toBe(1);
|
||||
|
||||
const [first] = chain;
|
||||
if (!first) throw new Error("Expected first record");
|
||||
const base = normalizeWhois(
|
||||
"gitpod.io",
|
||||
"io",
|
||||
|
||||
@@ -11,7 +11,8 @@ Changed: 2020-01-02
|
||||
`;
|
||||
const rec = normalizeWhois("example.de", "de", text, "whois.denic.de");
|
||||
expect(rec.nameservers && rec.nameservers.length === 2).toBe(true);
|
||||
expect(rec.nameservers?.[0].host).toBe("ns1.example.net");
|
||||
expect(rec.nameservers).toBeDefined();
|
||||
expect(rec.nameservers?.[0]?.host).toBe("ns1.example.net");
|
||||
});
|
||||
|
||||
test("WHOIS .uk Nominet style", () => {
|
||||
|
||||
@@ -155,7 +155,12 @@ export function normalizeWhois(
|
||||
map.eppstatus || // .fr
|
||||
[];
|
||||
const statuses = statusLines.length
|
||||
? statusLines.map((line) => ({ status: line.split(/\s+/)[0], raw: line }))
|
||||
? statusLines
|
||||
.map((line) => {
|
||||
const status = line.split(/\s+/)[0];
|
||||
return status ? { status, raw: line } : null;
|
||||
})
|
||||
.filter((s): s is { status: string; raw: string } => s !== null)
|
||||
: undefined;
|
||||
|
||||
// Nameservers: also appear as "nserver" on some ccTLDs (.de, .ru) and as "name server"
|
||||
@@ -219,8 +224,8 @@ export function normalizeWhois(
|
||||
: undefined;
|
||||
|
||||
// Simple lock derivation from statuses
|
||||
const transferLock = !!statuses?.some((s) =>
|
||||
/transferprohibited/i.test(s.status),
|
||||
const transferLock = !!statuses?.some(
|
||||
(s) => s.status && /transferprohibited/i.test(s.status),
|
||||
);
|
||||
|
||||
const record: DomainRecord = {
|
||||
|
||||
@@ -40,6 +40,6 @@ describe("WHOIS referral contradiction handling", () => {
|
||||
expect(Array.isArray(chain)).toBe(true);
|
||||
// Mocked registrar is contradictory, so chain should contain only the TLD response
|
||||
expect(chain.length).toBe(1);
|
||||
expect(chain[0].serverQueried).toBe("whois.nic.io");
|
||||
expect(chain[0]?.serverQueried).toBe("whois.nic.io");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user