feat: enhance SEO for listing and specialty pages, fix search autocomplete issue

This commit is contained in:
hamed
2026-07-20 10:26:03 +03:30
parent 9011b230b3
commit 30c3fe8637
14 changed files with 460 additions and 69 deletions
+27
View File
@@ -0,0 +1,27 @@
import { describe, expect, it } from "vitest";
import specialtiesData from "@/data/specialties.json";
import { isCategorySpecialty, isIndexableSpecialty } from "@/lib/specialtyIndexing";
const bySlug = (slug) => specialtiesData.find((item) => item.slug === slug);
describe("isCategorySpecialty", () => {
it("والدِ دارای زیرشاخهٔ فعال دسته است → noindex", () => {
expect(isCategorySpecialty(bySlug("internal-medicine"))).toBe(true);
});
it("زیرشاخه هرگز دسته نیست → index", () => {
expect(isCategorySpecialty(bySlug("gastroenterology"))).toBe(false);
expect(isIndexableSpecialty(bySlug("gastroenterology"))).toBe(true);
});
it("والدِ بدون زیرشاخه در عمل برگ است → index", () => {
expect(isCategorySpecialty(bySlug("general-practitioner"))).toBe(false);
expect(isIndexableSpecialty(bySlug("general-practitioner"))).toBe(true);
});
it("ورودی تهی امن است", () => {
expect(isCategorySpecialty(null)).toBe(false);
expect(isIndexableSpecialty(null)).toBe(false);
expect(isIndexableSpecialty(undefined)).toBe(false);
});
});