import { describe, expect, it } from "vitest"; import { isNoindexDoctor, isThinDoctor } from "@/lib/entityQuality"; const DOCTOR = { uuid: "1a55deaa-6c43-440d-b126-5870521ebc26", name: "دکتر رضایی", specialties: [{ name: "قلب و عروق" }], address: [{ address: "یاسوج، خیابان اصلی" }], }; describe("ایندکس‌پذیری پزشک", () => { it("پروفایل claim نشدهٔ دارای محتوا ایندکس می‌شود", () => { // پیش از این، همین حالت ۸۰ صفحهٔ یاسوج را noindex می‌کرد. expect(isNoindexDoctor({ ...DOCTOR, owner_status: "unclaimed" })).toBe(false); expect(isNoindexDoctor({ ...DOCTOR, owner_status: undefined })).toBe(false); }); it("پروفایل claim شده هم ایندکس می‌شود", () => { expect(isNoindexDoctor({ ...DOCTOR, owner_status: "claimed" })).toBe(false); }); it("پروفایل بی‌محتوا همچنان noindex می‌ماند", () => { expect( isNoindexDoctor({ uuid: DOCTOR.uuid, name: "دکتر رضایی" }) ).toBe(true); expect(isNoindexDoctor({ ...DOCTOR, name: "09121234567" })).toBe(true); expect(isNoindexDoctor({ ...DOCTOR, uuid: undefined })).toBe(true); }); it("تخصص یا نشانی، هرکدام به‌تنهایی کافی است", () => { expect(isThinDoctor({ ...DOCTOR, address: [] })).toBe(false); expect(isThinDoctor({ ...DOCTOR, specialties: [] })).toBe(false); }); });