fix(blog): represent absent article imagery honestly
Deploy Canina / deploy (push) Successful in 3m12s

This commit is contained in:
Canina Automation committed 2026-10-29 08:10:03 +00:00
1 parent 5642c1609c
commit 18094f91a6
17 files changed
+208 -24

No files matched your search

@@ -123,6 +123,24 @@ describe("BlogPreviewSection Component", () => {
expect(link2).toHaveAttribute("href", "/blog/cat-hair-loss-solutions");
});
it.each([null, undefined, "", " "])(
"renders neutral absence without an img for homepage imageUrl=%j",
async (imageUrl) => {
vi.mocked(api.get).mockResolvedValueOnce({
data: { blogs: [{
id: "no-image", slug: "no-image", title: "مقاله بدون عکس",
content: "", viewCount: 0, createdAt: "2026-01-01T00:00:00Z", imageUrl,
}] },
});
const { container } = render(<BlogPreviewSection />);
expect(await screen.findByText("مقاله بدون عکس")).toBeInTheDocument();
expect(screen.getByText("بدون تصویر")).toBeInTheDocument();
expect(container.querySelector("img")).toBeNull();
expect(api.get).toHaveBeenCalledWith("/blogs/homepage");
},
);
it("uses publication freshness and explicit byline labels on homepage cards", async () => {
vi.mocked(api.get).mockResolvedValueOnce({ data: { blogs: [{ id:"b",slug:"b",title:"B",content:"",viewCount:0,createdAt:"2026-01-01T00:00:00Z",publishedAt:"2026-01-01T00:00:00Z",contentUpdatedAt:"2026-01-02T00:00:00Z",authorTeam:"Science" }] } });
render(<BlogPreviewSection />);