chore: sync local workspace changes
This commit is contained in:
38
tests/mainChatPanel/chatDataTablePreview.test.ts
Normal file
38
tests/mainChatPanel/chatDataTablePreview.test.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { resolveTabularPreviewModel } from '../../src/app/main/mainChatPanel/ChatDataTablePreview';
|
||||
|
||||
test('resolveTabularPreviewModel parses object-array json into a table model', () => {
|
||||
const model = resolveTabularPreviewModel(
|
||||
{
|
||||
label: 'table.json',
|
||||
url: '/api/chat/resources/.codex_chat/chat-room/resource/reports/table.json',
|
||||
kind: 'code',
|
||||
},
|
||||
JSON.stringify([
|
||||
{ code: '005930', name: '삼성전자', changeRate: 2.5 },
|
||||
{ code: '000660', name: 'SK하이닉스', changeRate: 1.8 },
|
||||
]),
|
||||
);
|
||||
|
||||
assert.ok(model);
|
||||
assert.deepEqual(model.columns, ['code', 'name', 'changeRate']);
|
||||
assert.equal(model.rowCount, 2);
|
||||
assert.deepEqual(model.rows[0], ['005930', '삼성전자', '2.5']);
|
||||
});
|
||||
|
||||
test('resolveTabularPreviewModel parses csv into a table model', () => {
|
||||
const model = resolveTabularPreviewModel(
|
||||
{
|
||||
label: 'table.csv',
|
||||
url: '/api/chat/resources/.codex_chat/chat-room/resource/reports/table.csv',
|
||||
kind: 'document',
|
||||
},
|
||||
['code,name,reason', '005930,삼성전자,거래량 미달', '000660,SK하이닉스,등락률 미달'].join('\n'),
|
||||
);
|
||||
|
||||
assert.ok(model);
|
||||
assert.deepEqual(model.columns, ['code', 'name', 'reason']);
|
||||
assert.equal(model.rowCount, 2);
|
||||
assert.deepEqual(model.rows[1], ['000660', 'SK하이닉스', '등락률 미달']);
|
||||
});
|
||||
34
tests/mainChatPanel/messageParts.test.ts
Normal file
34
tests/mainChatPanel/messageParts.test.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { extractChatMessageParts } from '../../src/app/main/mainChatPanel/messageParts';
|
||||
|
||||
test('extractChatMessageParts keeps internal resource link-card lines as plain resource urls', () => {
|
||||
assert.deepEqual(
|
||||
extractChatMessageParts(
|
||||
[
|
||||
'표 원본입니다.',
|
||||
'[[link-card:테이블 열기|/api/chat/resources/.codex_chat/chat-room/resource/reports/table.json|열기]]',
|
||||
].join('\n'),
|
||||
),
|
||||
{
|
||||
strippedText: ['표 원본입니다.', '/api/chat/resources/.codex_chat/chat-room/resource/reports/table.json'].join('\n'),
|
||||
parts: [],
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
test('extractChatMessageParts does not promote relative internal resource markdown links into link cards', () => {
|
||||
assert.deepEqual(
|
||||
extractChatMessageParts(
|
||||
['문서 경로', '[/api/chat/resources 문서](/api/chat/resources/.codex_chat/chat-room/resource/source/chat-room-reference.md)'].join(
|
||||
'\n',
|
||||
),
|
||||
),
|
||||
{
|
||||
strippedText: ['문서 경로', '[/api/chat/resources 문서](/api/chat/resources/.codex_chat/chat-room/resource/source/chat-room-reference.md)'].join(
|
||||
'\n',
|
||||
),
|
||||
parts: [],
|
||||
},
|
||||
);
|
||||
});
|
||||
33
tests/mainChatPanel/previewItems.test.ts
Normal file
33
tests/mainChatPanel/previewItems.test.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
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, []);
|
||||
});
|
||||
Reference in New Issue
Block a user