feat(blog): enhance metadata generation and blog fetching by city context

This commit is contained in:
hamed
2026-07-19 09:02:14 +03:30
parent 88782e70c2
commit 4d7b87ee1a
5 changed files with 46 additions and 12 deletions
+14
View File
@@ -75,3 +75,17 @@ describe("extractEntityCityId", () => {
expect(extractEntityCityId(null)).toBeNull();
});
});
describe("شکل پاسخ بلاگ (city آبجکت یا null)", () => {
it("پست شهریافته → شناسه و دامنهٔ همان شهر", () => {
const post = { slug: "x", city: { id: "123", name: "یاسوج" } };
expect(extractEntityCityId(post)).toBe("123");
expect(findDomainByCityId(extractEntityCityId(post))).toBe("yasuj-nobat.ir");
});
it("پست سراسری (city: null) → بدون شهر، بدون دامنه", () => {
const post = { slug: "x", city: null };
expect(extractEntityCityId(post)).toBeNull();
expect(findDomainByCityId(extractEntityCityId(post))).toBeNull();
});
});