import test from 'node:test'; import assert from 'node:assert/strict'; import { renderPlazaPostRedirectHtml } from './plaza-public.mjs'; test('plaza post shell embeds publication with resilient height sync', () => { const html = renderPlazaPostRedirectHtml( { id: 'post-1', title: 'Tall post', summary: 'A tall publication' }, 'https://go.tkmind.cn/u/john/pages/tall', ); assert.match(html, /src="https:\/\/go\.tkmind\.cn\/u\/john\/pages\/tall\?embed=plaza"/); assert.match(html, /function measureFrameDocument\(\)/); assert.match(html, /body\.children\.length/); assert.match(html, /event\.source !== frame\.contentWindow/); assert.match(html, /sandbox="allow-scripts"/); assert.doesNotMatch(html, /sandbox="allow-same-origin allow-scripts"/); });