Defer property assessor email gate
This commit is contained in:
@@ -62,7 +62,7 @@ test("assessProperty asks for assessment purpose before building a decision-grad
|
||||
assert.equal(result.reportPayload, null);
|
||||
});
|
||||
|
||||
test("assessProperty auto-discovers listing sources, runs Zillow photos first, and asks for recipient email", async () => {
|
||||
test("assessProperty auto-discovers listing sources, runs Zillow photos first, and does not ask for email during analysis-only runs", async () => {
|
||||
const result = await assessProperty(
|
||||
{
|
||||
address: "4141 Whiteley Dr, Corpus Christi, TX 78418",
|
||||
@@ -97,9 +97,10 @@ test("assessProperty auto-discovers listing sources, runs Zillow photos first, a
|
||||
|
||||
assert.equal(result.ok, true);
|
||||
assert.equal(result.needsAssessmentPurpose, false);
|
||||
assert.equal(result.needsRecipientEmails, true);
|
||||
assert.equal(result.needsRecipientEmails, false);
|
||||
assert.equal(result.outputPath, null);
|
||||
assert.match(result.message, /target email/i);
|
||||
assert.doesNotMatch(result.message, /target email/i);
|
||||
assert.match(result.message, /ready to render|recipient email is only needed when you want the pdf/i);
|
||||
assert.equal(result.reportPayload?.subjectProperty?.address, samplePublicRecords.matchedAddress);
|
||||
assert.equal(result.reportPayload?.publicRecords?.jurisdiction, "Nueces County Appraisal District");
|
||||
assert.equal(result.reportPayload?.publicRecords?.accountNumber, "14069438");
|
||||
@@ -117,6 +118,40 @@ test("assessProperty auto-discovers listing sources, runs Zillow photos first, a
|
||||
assert.deepEqual(result.reportPayload?.recipientEmails, []);
|
||||
});
|
||||
|
||||
test("assessProperty asks for recipient email only when PDF render is explicitly requested", async () => {
|
||||
const result = await assessProperty(
|
||||
{
|
||||
address: "4141 Whiteley Dr, Corpus Christi, TX 78418",
|
||||
assessmentPurpose: "investment property",
|
||||
output: path.join(os.tmpdir(), `property-assess-missing-email-${Date.now()}.pdf`)
|
||||
},
|
||||
{
|
||||
resolvePublicRecordsFn: async () => samplePublicRecords,
|
||||
discoverListingSourcesFn: async () => ({
|
||||
attempts: ["Zillow discovery located a property page from the address."],
|
||||
zillowUrl:
|
||||
"https://www.zillow.com/homedetails/4141-Whiteley-Dr-Corpus-Christi-TX-78418/2103723704_zpid/",
|
||||
harUrl: null
|
||||
}),
|
||||
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(result.needsRecipientEmails, true);
|
||||
assert.equal(result.outputPath, null);
|
||||
assert.match(result.message, /target email/i);
|
||||
});
|
||||
|
||||
test("assessProperty falls back to HAR when Zillow photo extraction fails", async () => {
|
||||
const result = await assessProperty(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user