Harden assessor fallback after Zillow photo failure
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
import { normalizeImageCandidates, runWithOperationTimeout } from "./real-estate-photo-common.js";
|
||||
import {
|
||||
isPageClosedError,
|
||||
normalizeImageCandidates,
|
||||
runWithOperationTimeout,
|
||||
} from "./real-estate-photo-common.js";
|
||||
|
||||
test("normalizeImageCandidates keeps distinct Zillow photo URLs and strips query strings", () => {
|
||||
const result = normalizeImageCandidates(
|
||||
@@ -85,3 +89,15 @@ test("runWithOperationTimeout rejects stalled work and runs timeout cleanup", as
|
||||
|
||||
assert.equal(cleanedUp, true);
|
||||
});
|
||||
|
||||
test("isPageClosedError detects transient browser-session closure errors", () => {
|
||||
assert.equal(
|
||||
isPageClosedError(new Error("page.evaluate: Target page, context or browser has been closed")),
|
||||
true
|
||||
);
|
||||
assert.equal(
|
||||
isPageClosedError(new Error("Execution context was destroyed, most likely because of a navigation")),
|
||||
true
|
||||
);
|
||||
assert.equal(isPageClosedError(new Error("No Zillow image URLs were found")), false);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user