// Unit test for the public-offer page assembly: renderOffer splices the backend's price-list markdown // into BOTH language sources of the offer at the pricing marker and renders them with the shared // renderOfferHtml (bundled from ui/src/lib/offer). The prose rendering itself is unit-tested in ui/ // (offer.test.ts); here we assert the substitution reaches both languages and the tables render. import test from 'node:test'; import assert from 'node:assert/strict'; import { renderOffer, pricingMarker } from '../src/offer.mjs'; const tables = '| Наименование | Рубли | Голоса в VK | Stars в Telegram |\n' + '| --- | --- | --- | --- |\n' + '| 50 «Фишек» | 200.00 | 30 | 100 |'; test('splices the price list into both language sources and renders the tables', () => { const ru = `# Публичная оферта\n\n**4.4.** Стоимость Товаров:\n\n${pricingMarker}\n`; const en = `# Public offer\n\n**4.4.** Cost of the Goods:\n\n${pricingMarker}\n`; const html = renderOffer(ru, en, tables); // The marker is gone from both languages and the projected table reached the document. assert.ok(!html.includes(pricingMarker), 'the pricing marker must be substituted in both languages'); assert.ok(html.includes('
| 200.00 | '), 'a rouble price cell must be present'); assert.ok(html.includes('50 «Фишек»'), 'the product title must be present'); assert.ok(html.includes('