// Server renderer behavior, matching nanohtml 1.x server semantics. import { test } from 'node:test' import assert from 'node:assert' import html from '@choojs/html' import raw from '@choojs/html/raw' test('renders a template to a string', () => { const res = html`
hello
` assert.strictEqual(res.toString(), 'hello
') }) test('escapes interpolated text', () => { const res = html`${''}
` assert.strictEqual(res.toString(), '<script>alert(1)</script>
') }) test('raw() bypasses escaping', () => { const res = html`${raw('hi')}
` assert.strictEqual(res.toString(), 'hi
') }) test('nested templates are not double-encoded', () => { const inner = html`&` const res = html`${inner}
` assert.strictEqual(res.toString(), '&
') }) test('arrays of children are joined', () => { const items = ['a', 'b'].map((x) => html`