import { describe, expect, it } from 'vitest' import { FAQ_PAGE_SEO, FAQ_SCHEMA_ITEMS, faqRichResultsSchema, faqWebPageSchema } from '@/lib/seo/faqPage' describe('faq page SEO helpers', () => { it('keeps FAQ meta within SERP-safe length', () => { expect(FAQ_PAGE_SEO.metaTitle.length).toBeLessThanOrEqual(60) expect(FAQ_PAGE_SEO.metaDescription.length).toBeGreaterThanOrEqual(70) expect(FAQ_PAGE_SEO.metaDescription.length).toBeLessThanOrEqual(160) }) it('ships FAQPage rich-result entities aligned with schema items', () => { const faq = faqRichResultsSchema() expect(faq['@type']).toBe('FAQPage') expect(faq.mainEntity).toHaveLength(FAQ_SCHEMA_ITEMS.length) }) it('points booking and hosting intents at canonical product URLs', () => { const register = FAQ_SCHEMA_ITEMS.find((item) => item.question === 'چطور در یک رویداد ثبت‌نام کنم؟') const becomeHost = FAQ_SCHEMA_ITEMS.find((item) => item.question === 'چطور میزبان شوم و رویداد بسازم؟') expect(register?.answer).toContain('https://ghabilee.ir/faq') expect(becomeHost?.answer).toContain('https://ghabilee.ir/become-a-host') expect(becomeHost?.answer).toContain('https://ghabilee.ir/host-guide') }) it('emits a WebPage graph node with language and dates', () => { expect(faqWebPageSchema()).toMatchObject({ '@type': 'WebPage', inLanguage: 'fa-IR', url: 'https://ghabilee.ir/faq', }) }) })