Use Zillow parcel hints for CAD lookup
This commit is contained in:
@@ -146,6 +146,47 @@ test("assessProperty auto-discovers listing sources, runs Zillow photos first, a
|
||||
assert.deepEqual(result.reportPayload?.recipientEmails, []);
|
||||
});
|
||||
|
||||
test("assessProperty uses parcel/APN hints extracted from Zillow before CAD lookup when parcel ID was not provided", async () => {
|
||||
const seenPublicRecordOptions: Array<Record<string, unknown>> = [];
|
||||
|
||||
const result = await assessProperty(
|
||||
{
|
||||
address: "6702 Everhart Rd APT T106, Corpus Christi, TX 78413",
|
||||
assessmentPurpose: "college housing for daughter attending TAMU-CC"
|
||||
},
|
||||
{
|
||||
resolvePublicRecordsFn: async (_address, options) => {
|
||||
seenPublicRecordOptions.push({ ...options });
|
||||
return samplePublicRecords;
|
||||
},
|
||||
discoverListingSourcesFn: async () => ({
|
||||
attempts: ["Zillow discovery located a property page from the address."],
|
||||
zillowUrl:
|
||||
"https://www.zillow.com/homedetails/6702-Everhart-Rd-APT-T106-Corpus-Christi-TX-78413/2067445642_zpid/",
|
||||
harUrl: null
|
||||
}),
|
||||
extractZillowIdentifierHintsFn: async () => ({
|
||||
parcelId: "1234567890",
|
||||
notes: ["Zillow listing exposed parcel/APN number 1234567890."]
|
||||
}),
|
||||
extractPhotoDataFn: async (source, url) => ({
|
||||
source,
|
||||
requestedUrl: url,
|
||||
finalUrl: url,
|
||||
expectedPhotoCount: 29,
|
||||
complete: true,
|
||||
photoCount: 29,
|
||||
imageUrls: ["https://photos.example/1.jpg"],
|
||||
notes: [`${source} extractor succeeded.`]
|
||||
})
|
||||
}
|
||||
);
|
||||
|
||||
assert.equal(result.ok, true);
|
||||
assert.equal(seenPublicRecordOptions.length, 1);
|
||||
assert.equal(seenPublicRecordOptions[0]?.parcelId, "1234567890");
|
||||
});
|
||||
|
||||
test("assessProperty asks for recipient email only when PDF render is explicitly requested", async () => {
|
||||
const result = await assessProperty(
|
||||
{
|
||||
|
||||
@@ -291,3 +291,90 @@ test("resolvePublicRecords enriches official CAD property facts when a supported
|
||||
fetchedUrls.some((url) => url.includes("esearch.nuecescad.net/property/view/14069438"))
|
||||
);
|
||||
});
|
||||
|
||||
test("resolvePublicRecords uses formatted Nueces Geographic ID search when a parcel ID 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?")) {
|
||||
assert.match(url, /keywords=1234-5678-9012/);
|
||||
return JSON.stringify({
|
||||
success: true,
|
||||
resultsList: [
|
||||
{
|
||||
propertyId: "200016970",
|
||||
ownerName: "NGUYEN TRANG THUY",
|
||||
ownerId: "677681",
|
||||
address: "6702 Everhart Rd Apt T106, Corpus Christi, TX 78413",
|
||||
legalDescription: "UNIT T106 EXAMPLE CONDO",
|
||||
appraisedValueDisplay: "$128,876",
|
||||
detailUrl: "/property/view/200016970?year=2026"
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
if (url === "https://esearch.nuecescad.net/property/view/200016970?year=2026") {
|
||||
return `
|
||||
<html>
|
||||
<body>
|
||||
<div class="property-summary">
|
||||
<div>Owner Name</div><div>NGUYEN TRANG THUY</div>
|
||||
<div>Account Number</div><div>200016970</div>
|
||||
<div>Situs Address</div><div>6702 Everhart Rd Apt T106, Corpus Christi, TX 78413</div>
|
||||
<div>Legal Description</div><div>UNIT T106 EXAMPLE CONDO</div>
|
||||
<div>Land Value</div><div>$20,000</div>
|
||||
<div>Improvement Value</div><div>$108,876</div>
|
||||
<div>Market Value</div><div>$128,876</div>
|
||||
<div>Assessed Value</div><div>$128,876</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
}
|
||||
throw new Error(`Unexpected URL: ${url}`);
|
||||
};
|
||||
|
||||
const payload = await resolvePublicRecords("6702 Everhart Rd APT T106, Corpus Christi, TX 78413", {
|
||||
parcelId: "123456789012",
|
||||
fetchText: enrichedFetchText
|
||||
});
|
||||
|
||||
assert.equal(payload.propertyDetails?.propertyId, "200016970");
|
||||
assert.ok(
|
||||
fetchedUrls.some((url) => url.includes("keywords=1234-5678-9012"))
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user