import test from 'node:test'; import assert from 'node:assert/strict'; import { plainText } from '../src/html-text.js'; test('inline image emoji preserve the exact text order and wrapper titles do not duplicate them', () => { const html = '
ε₯½ε
A B👍🏼β€οΈ♥
beforeafter
Unclosed formatting'), 'Unclosed formattingπ');
});
test('scripts, styles, templates and comments never become body text or execute', () => {
globalThis.__teamsFictionalHtmlExecution = false;
try {
assert.equal(plainText('private-template
'), 'π');
assert.equal(globalThis.__teamsFictionalHtmlExecution, false);
} finally { delete globalThis.__teamsFictionalHtmlExecution; }
});
test('unknown image placeholders and bounded labels never expose image URLs or split surrogate pairs', () => {
const content = plainText('
');
assert.equal(content, '[εΎη]' + 'π'.repeat(200));
assert.doesNotMatch(content, /https:|private-id|\uFFFD/);
});
test('plain text, literal entity text and ordinary blank input remain supported', () => {
assert.equal(plainText('Plain & text'), 'Plain & text');
assert.equal(plainText('
<safe> & friends.
'), '