Enrich property assessor with CAD detail data

This commit is contained in:
2026-03-28 02:07:18 -05:00
parent b1722a04fa
commit 7690dc259b
6 changed files with 561 additions and 13 deletions

View File

@@ -196,3 +196,98 @@ test("resolvePublicRecords retries fallback geocoding without the unit suffix",
assert.equal(payload.county.name, "Nueces County");
assert.equal(payload.state.code, "TX");
});
test("resolvePublicRecords enriches official CAD property facts when a supported CAD detail source is available", async () => {
const fetchedUrls: string[] = [];
const enrichedFetchText = async (url: string): Promise<string> => {
fetchedUrls.push(url);
if (url.includes("geocoding.geo.census.gov")) {
return JSON.stringify(geocoderPayload);
}
if (url.endsWith("/county-directory/")) {
return countyIndexHtml;
}
if (url.endsWith("/county-directory/nueces.php")) {
return countyPageHtml.replace(
"http://www.ncadistrict.com/",
"https://nuecescad.net/"
);
}
if (url === "https://nuecescad.net/") {
return `
<html>
<body>
<a href="https://esearch.nuecescad.net/">Property Search</a>
</body>
</html>
`;
}
if (url === "https://esearch.nuecescad.net/") {
return `
<html>
<head>
<meta name="search-token" content="token-value|2026-03-28T00:00:00Z" />
</head>
<body>
Property Search
</body>
</html>
`;
}
if (url.includes("/search/SearchResults?")) {
return JSON.stringify({
success: true,
resultsList: [
{
propertyId: "14069438",
ownerName: "Fiorini Family Trust",
ownerId: "998877",
address: "4141 Whiteley Dr, Corpus Christi, TX 78418",
legalDescription: "LOT 4 BLOCK 3 EXAMPLE SUBDIVISION",
appraisedValueDisplay: "$141,000",
detailUrl: "/property/view/14069438?year=2026"
}
]
});
}
if (url === "https://esearch.nuecescad.net/property/view/14069438?year=2026") {
return `
<html>
<body>
<div class="property-summary">
<div>Owner Name</div><div>Fiorini Family Trust</div>
<div>Account Number</div><div>14069438</div>
<div>Situs Address</div><div>4141 Whiteley Dr, Corpus Christi, TX 78418</div>
<div>Legal Description</div><div>LOT 4 BLOCK 3 EXAMPLE SUBDIVISION</div>
<div>Land Value</div><div>$42,000</div>
<div>Improvement Value</div><div>$99,000</div>
<div>Market Value</div><div>$141,000</div>
<div>Assessed Value</div><div>$141,000</div>
<div>Exemptions</div><div>Homestead</div>
</div>
</body>
</html>
`;
}
throw new Error(`Unexpected URL: ${url}`);
};
const payload = await resolvePublicRecords("4141 Whiteley Dr, Corpus Christi, TX 78418", {
fetchText: enrichedFetchText
});
assert.equal(payload.propertyDetails?.propertyId, "14069438");
assert.equal(payload.propertyDetails?.ownerName, "Fiorini Family Trust");
assert.equal(payload.propertyDetails?.landValue, 42000);
assert.equal(payload.propertyDetails?.improvementValue, 99000);
assert.equal(payload.propertyDetails?.assessedTotalValue, 141000);
assert.deepEqual(payload.propertyDetails?.exemptions, ["Homestead"]);
assert.match(
payload.lookupRecommendations.join(" "),
/official cad property detail/i
);
assert.ok(
fetchedUrls.some((url) => url.includes("esearch.nuecescad.net/property/view/14069438"))
);
});