import { describe, it, expect, vi } from 'vitest' import { renderToStaticMarkup } from 'react-dom/server' import About from '../app/(site)/[locale]/about/page' import Projects from '../app/(site)/[locale]/projects/page' import Contacts from '../app/(site)/[locale]/contacts/page' import News from '../app/(site)/[locale]/news/page' import NewsItem from '../app/(site)/[locale]/news/[id]/page' import { getDict, locales } from '../i18n' import { loadNews } from './content' vi.mock('@/app/actions/inquiry', () => ({ submitInquiry: vi.fn() })) vi.mock('./content', () => ({ loadContent: vi.fn(async () => ({ home: null, news: [] })), loadNews: vi.fn(async () => []), loadLegal: vi.fn(async () => null), })) describe('Разделы и языки', () => { for (const locale of locales) { const params = Promise.resolve({ locale }) it(`Нет сведений о руководстве: блоки и пометки скрыты, цели не повторяют миссию — ${locale}`, async () => { const html = renderToStaticMarkup(await About({ params })) const t = getDict(locale) expect(html).not.toContain(t.sections.founder) expect(html).not.toContain(t.sections.leadership) expect(html).not.toContain(t.sections.board) expect(html).not.toContain(t.sections.partners) expect(html).not.toContain(t.tbc) expect(html).toContain(t.mission.text) expect(html).toContain(t.sections.goalText) expect(t.mission.text).not.toContain(t.sections.goalText) }) it(`Переключение языка каталога сохраняет путь — ${locale}`, async () => { const html = renderToStaticMarkup(await Projects({ params })) for (const language of locales) expect(html).toContain(`/${language}/projects`) expect(html).toContain(`/${locale}/projects/ermek-serkebayev`) expect(html).toContain('cover.jpg') }) it(`Контакты: почта и Instagram по решению QLFW-11 — ${locale}`, async () => { const html = renderToStaticMarkup(await Contacts({ params })) expect(html).toContain('mailto:qazaqlegacy@gmail.com') expect(html).toContain('https://www.instagram.com/serkebayev_book/') expect(html).not.toContain(`/${locale}/privacy`) expect(html).toContain('