Files
nobat724_front/lib/cityIntro.test.js
T
hamed 9cfbd2e002 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.
2026-08-08 21:06:48 +03:30

35 lines
1.4 KiB
JavaScript

import { describe, expect, it } from "vitest";
import { buildClinicsIntro } from "@/lib/listingIntro";
describe("جملهٔ آماری متن صفحات لیست", () => {
it("دو شهرِ هم‌variant با آمار متفاوت، متن یکسان نمی‌گیرند", () => {
// بهبهان و یاسوج روی CLINIC_INTROS هم‌variant‌اند؛ پیش از افزودن عدد، متنشان
// تقریباً یکی می‌شد و شباهت /clinics از ۶۸.۹٪ به ۸۴.۷٪ رفت.
const a = buildClinicsIntro("بهبهان", 12);
const b = buildClinicsIntro("یاسوج", 31);
expect(a).not.toBe(b);
expect(a).toContain("12");
expect(b).toContain("31");
});
it("آمار صفر جمله را اضافه نمی‌کند", () => {
const withZero = buildClinicsIntro("بهبهان", 0);
const without = buildClinicsIntro("بهبهان");
expect(withZero).toBe(without);
expect(withZero).not.toContain("0 مرکز درمانی");
});
it("ورودی نامعتبر جمله را اضافه نمی‌کند", () => {
const text = buildClinicsIntro("بهبهان", "abc");
expect(text).not.toContain("NaN");
expect(text).toBe(buildClinicsIntro("بهبهان"));
});
it("نام شهر و واحد درست در جمله می‌آید", () => {
expect(buildClinicsIntro("یزد", 9)).toContain("9 مرکز درمانی در یزد");
});
});