const { test } = require('node:test'); const assert = require('node:assert/strict'); const path = require('node:path'); const { pathToFileURL } = require('node:url'); async function sourcesModule() { return import(pathToFileURL(path.join(__dirname, '..', 'public/js/assistant/sources.js')).href); } test('assistant source excerpts hide image markdown but keep OCR text', async () => { const { renderSourcesList } = await sourcesModule(); const html = renderSourcesList([{ title: 'Nelson', excerpt: '![](/tmp/pdf-images/pdf-0132-02.png) AGE STREAMS OF DEVELOPMENT' }]); assert.match(html, /AGE STREAMS OF DEVELOPMENT/); assert.doesNotMatch(html, /tmp\/pdf-images|!\[\]/); });