import { createElement } from 'react' import { renderToStaticMarkup } from 'react-dom/server' import { describe, expect, it } from 'vitest' import { getDict } from '@/i18n' import { ContactEmailFallback } from './ContactEmailFallback' describe('Запасная почта', () => { for (const locale of ['ru', 'kk', 'en'] as const) { const render = (email: string) => renderToStaticMarkup(createElement(ContactEmailFallback, { text: getDict(locale).form.fallback, email })) it(`Почта видна: ${locale}`, () => { const html = render('qazaqlegacy@gmail.com') expect(html).toContain(getDict(locale).form.fallback) expect(html).toContain('qazaqlegacy@gmail.com') expect(html).not.toContain('[email protected]') }) it(`Адрес отсутствует: ${locale}`, () => { expect(render('')).toBe('') expect(render(' ')).toBe('') }) it(`Адрес экранируется: ${locale}`, () => { expect(render('')).not.toContain('