Preserve accumulated client implementation since v0.1.4, including local identities, multi-server state, chat, administration, audio and streaming controls. Refine official-source layout, original artwork, responsive composer overflow, settings navigation and chat scroll anchoring. Current verification: Node suite passes; isolated packaged chat and responsive control smokes pass without device capture. Native core is reused, not rebuilt in this pass. Strict whole-screen visual parity remains incomplete; no 1:1 or cross-platform acceptance claim. Local checkpoint only; no release or push.
25 lines
1.4 KiB
JavaScript
25 lines
1.4 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { parseMarkdown, toPlainText, emojiForShortcode } from '../app/renderer/js/markdown/parse.js';
|
|
import { maliciousMessages, richMessage } from './fixtures/chat-markup.mjs';
|
|
|
|
function types(value, found = new Set()) {
|
|
if (!value || typeof value !== 'object') return found;
|
|
if (value.type) found.add(value.type);
|
|
for (const child of Object.values(value)) if (child && typeof child === 'object') types(child, found);
|
|
return found;
|
|
}
|
|
test('official dialect produces rich nodes rather than escaped advertised features', () => {
|
|
const tree = parseMarkdown(richMessage); const found = types(tree);
|
|
for (const type of ['heading', 'strong', 'em', 'u', 'mark', 'spoiler', 'emoji', 'blockquote', 'details', 'align', 'table', 'list', 'fnref', 'math', 'mermaid']) assert.ok(found.has(type), type);
|
|
assert.ok(toPlainText(tree).includes('legacy')); assert.ok(emojiForShortcode('smile'));
|
|
});
|
|
test('generated malicious inputs stay data and parser has bounded nesting', () => {
|
|
for (const source of maliciousMessages) {
|
|
const tree = parseMarkdown(source); assert.equal(tree.type, 'doc');
|
|
assert.equal(types(tree).has('html'), false); assert.equal(types(tree).has('script'), false);
|
|
}
|
|
const deep = parseMarkdown('[b]'.repeat(1000) + 'text' + '[/b]'.repeat(1000));
|
|
assert.ok(toPlainText(deep).includes('text'));
|
|
});
|