fix: make property-assessor safer for whatsapp runs

This commit is contained in:
2026-03-28 01:28:59 -05:00
parent 2deeb31369
commit 3d7ce7617c
15 changed files with 640 additions and 217 deletions

View File

@@ -0,0 +1,32 @@
import test from "node:test";
import assert from "node:assert/strict";
import { discoverListingSources } from "../src/listing-discovery.js";
import { extractPhotoData } from "../src/photo-review.js";
test("discoverListingSources times out stalled Zillow and HAR discovery calls", async () => {
const result = await discoverListingSources(
"1011 Ennis Joslin Rd APT 235, Corpus Christi, TX 78412",
{
timeoutMs: 20,
discoverZillowListingFn: async () => await new Promise(() => {}),
discoverHarListingFn: async () => await new Promise(() => {})
}
);
assert.equal(result.zillowUrl, null);
assert.equal(result.harUrl, null);
assert.match(result.attempts.join(" "), /zillow discovery timed out/i);
assert.match(result.attempts.join(" "), /har discovery timed out/i);
});
test("extractPhotoData times out a stalled photo extraction instead of hanging forever", async () => {
await assert.rejects(
async () =>
extractPhotoData("zillow", "https://www.zillow.com/example", {
timeoutMs: 20,
extractZillowPhotosFn: async () => await new Promise(() => {})
}),
/timed out/i
);
});