mirror of
https://github.com/jakejarvis/rdapper.git
synced 2026-09-23 02:35:31 -04:00
Implement WHOIS referral chain collection and merging logic (fixes #11)
- Introduced `collectWhoisReferralChain` to gather WHOIS responses while avoiding contradictory data from registrars. - Updated `lookupDomain` to utilize the new chain collection method, ensuring TLD responses are prioritized. - Added `mergeWhoisRecords` function to consolidate WHOIS data from multiple sources. - Enhanced tests for referral handling and merging behavior, ensuring accurate data retention across scenarios.
This commit is contained in:
@@ -17,7 +17,7 @@ vi.mock("./client.js", () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
import { followWhoisReferrals } from "./referral";
|
||||
import { collectWhoisReferralChain, followWhoisReferrals } from "./referral";
|
||||
|
||||
describe("WHOIS referral contradiction handling", () => {
|
||||
it("keeps TLD WHOIS when registrar claims availability", async () => {
|
||||
@@ -30,4 +30,16 @@ describe("WHOIS referral contradiction handling", () => {
|
||||
expect(res.text.toLowerCase().includes("creation date")).toBe(true);
|
||||
expect(res.text.toLowerCase().includes("no match")).toBe(false);
|
||||
});
|
||||
|
||||
it("collects chain and does not append contradictory registrar", async () => {
|
||||
const chain = await collectWhoisReferralChain(
|
||||
"whois.nic.io",
|
||||
"raindrop.io",
|
||||
{ followWhoisReferral: true, maxWhoisReferralHops: 2 },
|
||||
);
|
||||
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");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user