Fix property assessor geocode fallback

This commit is contained in:
2026-03-28 00:25:31 -05:00
parent 7570f748f0
commit c68523386d
6 changed files with 275 additions and 19 deletions

View File

@@ -224,3 +224,45 @@ test("assessProperty renders a PDF when recipient email is present", async () =>
const stat = await fs.promises.stat(outputPath);
assert.ok(stat.size > 1000);
});
test("assessProperty prioritizes student housing guidance over investment fallback keywords", async () => {
const result = await assessProperty(
{
address: "1011 Ennis Joslin Rd APT 235, Corpus Christi, TX 78412",
assessmentPurpose:
"college housing for daughter attending TAMU-CC; prioritize proximity, safety/livability, and resale/rental fallback"
},
{
resolvePublicRecordsFn: async () => samplePublicRecords,
discoverListingSourcesFn: async () => ({
attempts: ["Zillow discovery located a property page from the address."],
zillowUrl:
"https://www.zillow.com/homedetails/1011-Ennis-Joslin-Rd-APT-235-Corpus-Christi-TX-78412/28848927_zpid/",
harUrl: null
}),
extractPhotoDataFn: async (source, url) => ({
source,
requestedUrl: url,
finalUrl: url,
expectedPhotoCount: 20,
complete: true,
photoCount: 20,
imageUrls: ["https://photos.example/1.jpg"],
notes: [`${source} extractor succeeded.`]
})
}
);
assert.match(
String(result.reportPayload?.verdict?.offerGuidance),
/daughter|student|practicality|safety/i
);
assert.doesNotMatch(
String(result.reportPayload?.verdict?.offerGuidance),
/income property|investment property/i
);
assert.match(
String(result.reportPayload?.carryView?.[0]),
/parent-risk|upkeep burden|renting/i
);
});