qazaq-legacy-foundation-web/src/components/book-where.test.ts
Peppa b3e3d0d5bd QLFW-44: Marwin ведёт на страницу книги
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 22:30:38 +05:00

32 lines
1.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { createElement } from 'react'
import { renderToStaticMarkup } from 'react-dom/server'
import { describe, expect, it } from 'vitest'
import { getDict } from '@/i18n'
import { BookWhere } from './BookWhere'
const render = (l: 'ru' | 'kk' | 'en') => {
const d = getDict(l)
return renderToStaticMarkup(createElement(BookWhere, { t: d.book, tbc: d.tbc }))
}
describe('Сценарий: где купить книгу', () => {
it('русский текст целиком, площадки и магазины списком со ссылками', () => {
const html = render('ru')
expect(html).toContain('Где купить книгу')
expect(html).toContain('можно приобрести онлайн на платформах:')
expect(html).toContain('href="https://www.marwin.kz/product/serkebaeva-i-ermek-serkebaev-i-zhizn-i-molodost-i-schaste-220988"')
expect(html).toContain('href="https://www.flip.kz/catalog?prod=6364653')
expect(html).toContain('href="https://erudit.kz/"')
expect(html).toContain('Книжный мир')
expect(html).toContain('<p class="mt-3 text-muted">Наличие и стоимость книги уточняйте непосредственно у продавцов.</p>')
})
it.each(['kk', 'en'] as const)('язык %s: те же магазины, без пометок', (l) => {
const html = render(l)
expect(html).toContain('href="https://www.marwin.kz/product/serkebaeva-i-ermek-serkebaev-i-zhizn-i-molodost-i-schaste-220988"')
expect(html).toContain('href="https://www.flip.kz/catalog?prod=6364653')
expect(html).toContain('Эрудит')
expect(html).toContain('Книжный мир')
expect(html).not.toContain(getDict(l).tbc)
})
})