34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import { extractPreviewItems } from '../../src/app/main/mainChatPanel/previewItems';
|
|
|
|
test('extractPreviewItems keeps source preview images in chat resources', () => {
|
|
const items = extractPreviewItems([
|
|
{
|
|
id: 1,
|
|
author: 'codex',
|
|
text: '[[preview:/api/chat/resources/.codex_chat/chat-room/resource/source/layoutPreview1.png]]',
|
|
timestamp: '2026-05-02 08:32:00',
|
|
parts: [],
|
|
},
|
|
]);
|
|
|
|
assert.equal(items.length, 1);
|
|
assert.equal(items[0]?.url, '/api/chat/resources/.codex_chat/chat-room/resource/source/layoutPreview1.png');
|
|
assert.equal(items[0]?.kind, 'image');
|
|
});
|
|
|
|
test('extractPreviewItems still hides internal src code files from chat resources', () => {
|
|
const items = extractPreviewItems([
|
|
{
|
|
id: 1,
|
|
author: 'codex',
|
|
text: '/api/chat/resources/.codex_chat/chat-room/resource/src/app/main/MainChatPanel.tsx',
|
|
timestamp: '2026-05-02 08:32:00',
|
|
parts: [],
|
|
},
|
|
]);
|
|
|
|
assert.deepEqual(items, []);
|
|
});
|