From 1a21531c17298321ea7fc041e3cf1289b4e21dc7 Mon Sep 17 00:00:00 2001 From: Peppa Date: Tue, 17 Nov 2026 18:38:02 +0500 Subject: [PATCH] =?UTF-8?q?QLFW-44:=20=D1=82=D0=B5=D1=81=D1=82=D1=8B=20?= =?UTF-8?q?=D1=81=D1=81=D1=8B=D0=BB=D0=BE=D0=BA=20=D0=BD=D0=B0=20=D0=BC?= =?UTF-8?q?=D0=B0=D0=B3=D0=B0=D0=B7=D0=B8=D0=BD=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 --- src/components/book-where.test.ts | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/components/book-where.test.ts b/src/components/book-where.test.ts index afb3bc7..af1533d 100644 --- a/src/components/book-where.test.ts +++ b/src/components/book-where.test.ts @@ -2,28 +2,33 @@ import { createElement } from 'react' import { renderToStaticMarkup } from 'react-dom/server' import { describe, expect, it } from 'vitest' import { getDict } from '@/i18n' +import { bookUrl, marwinUrl } from '@/lib/home-model' import { BookWhere } from './BookWhere' const render = (l: 'ru' | 'kk' | 'en') => { const d = getDict(l) return renderToStaticMarkup(createElement(BookWhere, { t: d.book, tbc: d.tbc })) } +const link = (href: string, name: string) => + `${name}` describe('Сценарий: где купить книгу', () => { - it('русский текст целиком, площадки списком без ссылок', () => { - const html = render('ru') - expect(html).toContain('Где купить книгу') - expect(html).toContain('можно приобрести онлайн на платформах:') - expect(html).toContain('
  • Marwin
  • Flip.kz
  • ') - expect(html).toContain('

    Наличие и стоимость книги уточняйте непосредственно у продавцов.

    ') - expect(html).not.toContain(' { + it.each(['ru', 'kk', 'en'] as const)('язык %s: Marwin и Flip.kz — ссылки в новой вкладке, без пометок', (l) => { const html = render(l) - expect(html).toContain('
  • Marwin
  • Flip.kz
  • ') + expect(html).toContain(link(marwinUrl, 'Marwin')) + expect(html).toContain(link(bookUrl, 'Flip.kz')) expect(html).toContain('Эрудит') expect(html).toContain('Книжный мир') expect(html).not.toContain(getDict(l).tbc) - expect(html).not.toContain(' { + const html = render('ru') + expect(html).toContain('Где купить книгу') + expect(html).toContain('Наличие и стоимость книги уточняйте непосредственно у продавцов.') + }) + it('без адреса магазина ссылка не показывается, название остаётся', () => { + const d = getDict('ru') + const html = renderToStaticMarkup(createElement(BookWhere, { t: { ...d.book, buy: { ...d.book.buy!, platforms: ['Неизвестный'] } } })) + expect(html).toContain('
  • Неизвестный
  • ') }) })