Trust embedded Zillow photo sets without visible count

This commit is contained in:
2026-03-28 03:40:50 -05:00
parent 446d43cc78
commit ece8fc548f
5 changed files with 86 additions and 7 deletions

View File

@@ -84,5 +84,38 @@ test("shouldUseStructuredZillowPhotos returns false when structured photos are i
url: `https://photos.zillowstatic.com/fp/photo-${index + 1}-p_d.jpg`,
}));
assert.equal(shouldUseStructuredZillowPhotos(candidates, 29), false);
assert.equal(shouldUseStructuredZillowPhotos(candidates, { expectedPhotoCount: 29 }), false);
});
test("shouldUseStructuredZillowPhotos returns true when meta-description count matches even without visible page count", () => {
const candidates = Array.from({ length: 29 }, (_, index) => ({
url: `https://photos.zillowstatic.com/fp/photo-${index + 1}-p_d.jpg`,
}));
assert.equal(
shouldUseStructuredZillowPhotos(candidates, { expectedPhotoCount: null, fallbackPhotoCount: 29 }),
true
);
});
test("shouldUseStructuredZillowPhotos returns true for a substantial structured set when no count signal is available", () => {
const candidates = Array.from({ length: 18 }, (_, index) => ({
url: `https://photos.zillowstatic.com/fp/photo-${index + 1}-p_d.jpg`,
}));
assert.equal(
shouldUseStructuredZillowPhotos(candidates, { expectedPhotoCount: null, fallbackPhotoCount: null }),
true
);
});
test("shouldUseStructuredZillowPhotos returns false for a tiny structured set when no count signal is available", () => {
const candidates = Array.from({ length: 5 }, (_, index) => ({
url: `https://photos.zillowstatic.com/fp/photo-${index + 1}-p_d.jpg`,
}));
assert.equal(
shouldUseStructuredZillowPhotos(candidates, { expectedPhotoCount: null, fallbackPhotoCount: null }),
false
);
});