QLFW-44: тесты ссылок Marwin и Flip.kz
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ecc93c4ed2
commit
08e2cb0ed5
@ -2,7 +2,6 @@ import { createElement } from 'react'
|
||||
import { renderToStaticMarkup } from 'react-dom/server'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { getDict } from '@/i18n'
|
||||
import { bookUrl } from '@/lib/home-model'
|
||||
import { BookWhere } from './BookWhere'
|
||||
|
||||
const render = (l: 'ru' | 'kk' | 'en') => {
|
||||
@ -11,21 +10,20 @@ const render = (l: 'ru' | 'kk' | 'en') => {
|
||||
}
|
||||
|
||||
describe('Сценарий: где купить книгу', () => {
|
||||
it('русский текст целиком, Flip.kz — ссылка в новой вкладке, Marwin без адреса — просто текст', () => {
|
||||
it('русский текст целиком, площадки списком без ссылок', () => {
|
||||
const html = render('ru')
|
||||
expect(html).toContain('Где купить книгу')
|
||||
expect(html).toContain('можно приобрести онлайн на платформах:')
|
||||
expect(html).toContain('<li>Marwin</li>')
|
||||
expect(html).toContain(`<a href="${bookUrl.replace(/&/g, '&')}" target="_blank" rel="noopener noreferrer" class="underline">Flip.kz</a>`)
|
||||
expect(html).toContain('<li>Marwin</li><li>Flip.kz</li>')
|
||||
expect(html).toContain('<p class="mt-3 text-muted">Наличие и стоимость книги уточняйте непосредственно у продавцов.</p>')
|
||||
expect(html).not.toContain('<a')
|
||||
})
|
||||
it.each(['kk', 'en'] as const)('язык %s: те же магазины, без пометок', (l) => {
|
||||
const html = render(l)
|
||||
expect(html).toContain('<li>Marwin</li>')
|
||||
expect(html).toContain('target="_blank"')
|
||||
expect(html).toContain('>Flip.kz</a>')
|
||||
expect(html).toContain('<li>Marwin</li><li>Flip.kz</li>')
|
||||
expect(html).toContain('Эрудит')
|
||||
expect(html).toContain('Книжный мир')
|
||||
expect(html).not.toContain(getDict(l).tbc)
|
||||
expect(html).not.toContain('<a')
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user