feat: Revert homepage changes, fix Persian slug 404, and make various article and about us adjustments
- Removed the newly added city-focused section from the homepage. - Fixed 404 error for Persian slugs in specialties and blog pages by implementing a decode helper. - Removed the "مخصوص شهر" label from article headers. - Linked article tags to their respective filter pages. - Adjusted related content images to prevent distortion. - Added a section in the "About Us" page for physician registration guidance. - Updated the logo in the "About Us" header to the correct version. - Added tests for the new functionality and ensured existing tests are updated accordingly.
This commit is contained in:
+1
-67
@@ -1,71 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import cityData from "@/data/city.json";
|
||||
import {
|
||||
buildCityIntro,
|
||||
buildClinicsIntro,
|
||||
} from "@/lib/listingIntro";
|
||||
|
||||
const CITIES = ["بهبهان", "یاسوج", "یزد", "تبریز", "اصفهان"];
|
||||
|
||||
describe("buildCityIntro", () => {
|
||||
it("دو شهر متن یکسان نمیگیرند", () => {
|
||||
const a = buildCityIntro("بهبهان", 12, "جراحی عمومی");
|
||||
const b = buildCityIntro("یاسوج", 80, "جراحی عمومی");
|
||||
|
||||
expect(a).not.toBe(b);
|
||||
});
|
||||
|
||||
it("یک شهر در دو فراخوانی همان متن را میدهد", () => {
|
||||
// ناپایداری یعنی محتوای صفحهٔ اصلی با هر rebuild عوض شود.
|
||||
expect(buildCityIntro("بهبهان", 12, "جراحی عمومی")).toBe(
|
||||
buildCityIntro("بهبهان", 12, "جراحی عمومی")
|
||||
);
|
||||
});
|
||||
|
||||
it("نام شهر و عدد و تخصص در متن میآیند", () => {
|
||||
const text = buildCityIntro("بهبهان", 12, "جراحی عمومی");
|
||||
|
||||
expect(text).toContain("بهبهان");
|
||||
expect(text).toContain("12");
|
||||
expect(text).toContain("جراحی عمومی");
|
||||
});
|
||||
|
||||
it("شمار صفر جمله را نمیشکند", () => {
|
||||
const text = buildCityIntro("شهر تازه", 0, "");
|
||||
|
||||
expect(text).toContain("شهر تازه");
|
||||
expect(text).not.toContain("undefined");
|
||||
expect(text).not.toContain("NaN");
|
||||
});
|
||||
|
||||
it("ورودی نامعتبر به صفر و تخصص پیشفرض میافتد", () => {
|
||||
const text = buildCityIntro("شهر", "abc", null);
|
||||
|
||||
expect(text).not.toContain("NaN");
|
||||
expect(text).toContain("پزشکی عمومی");
|
||||
});
|
||||
|
||||
it("متنها روی شهرهای واقعی به یک قالب واحد نمیچسبند", () => {
|
||||
// اگر همهٔ شهرها یک variant بگیرند، دوباره همان duplicate ساخته میشود.
|
||||
const texts = CITIES.map((c) => buildCityIntro(c, 10, "قلب و عروق"));
|
||||
|
||||
expect(new Set(texts).size).toBeGreaterThan(1);
|
||||
});
|
||||
|
||||
it("متن به قدر کافی بلند هست که سیگنال محتوایی باشد", () => {
|
||||
for (const city of CITIES) {
|
||||
expect(buildCityIntro(city, 10, "قلب").length).toBeGreaterThan(200);
|
||||
}
|
||||
});
|
||||
|
||||
it("روی همهٔ شهرهای واقعی city.json بدون خطا اجرا میشود", () => {
|
||||
for (const city of cityData) {
|
||||
const text = buildCityIntro(city.name, 5, "داخلی");
|
||||
expect(typeof text).toBe("string");
|
||||
expect(text).not.toContain("undefined");
|
||||
}
|
||||
});
|
||||
});
|
||||
import { buildClinicsIntro } from "@/lib/listingIntro";
|
||||
|
||||
describe("جملهٔ آماری متن صفحات لیست", () => {
|
||||
it("دو شهرِ همvariant با آمار متفاوت، متن یکسان نمیگیرند", () => {
|
||||
|
||||
Reference in New Issue
Block a user