admin/lib/seo/faqPage.test.ts
alisaza e1eaf5eff5 feat: initial ghabilee-admin backoffice app
Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js
app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
2026-09-05 13:12:59 +03:30

36 lines
1.5 KiB
TypeScript

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',
})
})
})