feat: Refactor clinic-related functions and tests, removing doctor intro logic

This commit is contained in:
hamed
2026-08-08 20:26:17 +03:30
parent c118791911
commit 72beb8b591
4 changed files with 60 additions and 65 deletions
+5 -7
View File
@@ -3,7 +3,6 @@ import cityData from "@/data/city.json";
import {
buildCityIntro,
buildClinicsIntro,
buildDoctorsIntro,
} from "@/lib/listingIntro";
const CITIES = ["بهبهان", "یاسوج", "یزد", "تبریز", "اصفهان"];
@@ -81,22 +80,21 @@ describe("جملهٔ آماری متن صفحات لیست", () => {
});
it("آمار صفر جمله را اضافه نمی‌کند", () => {
const withZero = buildDoctorsIntro("بهبهان", 0);
const without = buildDoctorsIntro("بهبهان");
const withZero = buildClinicsIntro("بهبهان", 0);
const without = buildClinicsIntro("بهبهان");
expect(withZero).toBe(without);
expect(withZero).not.toContain("0 پزشک");
expect(withZero).not.toContain("0 مرکز درمانی");
});
it("ورودی نامعتبر جمله را اضافه نمی‌کند", () => {
const text = buildDoctorsIntro("بهبهان", "abc");
const text = buildClinicsIntro("بهبهان", "abc");
expect(text).not.toContain("NaN");
expect(text).toBe(buildDoctorsIntro("بهبهان"));
expect(text).toBe(buildClinicsIntro("بهبهان"));
});
it("نام شهر و واحد درست در جمله می‌آید", () => {
expect(buildDoctorsIntro("یزد", 40)).toContain("40 پزشک در یزد");
expect(buildClinicsIntro("یزد", 9)).toContain("9 مرکز درمانی در یزد");
});
});