d7fc4c5b6f
抽出 Home/Project 共用的 DirectCodexTurnAttachment 与渲染函数 Direct command 在进 Codex 前拼接有界 sidecar,jsonl 与气泡仍写用户原文 首页建项 latch 把导入附件传给 Direct 首轮,后续手打消息不带 attachments 做方案首轮仍走 Supervisor,不注入 sidecar 补齐 Rust 渲染测试与 home.suite 附件断言 记录路径映射合同与决策 Reviewed-on: http://192.168.35.82/git/GenarrativeAI/Genarrative/pulls/223 Co-authored-by: 孔令弘 <ink29535@proton.me> Co-committed-by: 孔令弘 <ink29535@proton.me>
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import { toDirectCodexTurnAttachments } from '../src/features/app-shell/directCodexTurnAttachments';
|
|
|
|
describe('toDirectCodexTurnAttachments', () => {
|
|
it('maps imported files and omits error plus empty localPath', () => {
|
|
expect(
|
|
toDirectCodexTurnAttachments([
|
|
{
|
|
fileName: '角色参考.png',
|
|
mediaType: 'image/png',
|
|
localPath: 'assets/uploads/upload-1-角色参考.png',
|
|
status: 'imported',
|
|
size: 12,
|
|
},
|
|
{
|
|
fileName: 'lost.bin',
|
|
mediaType: 'application/octet-stream',
|
|
status: 'failed',
|
|
error: '磁盘不可写',
|
|
size: 2,
|
|
},
|
|
]),
|
|
).toEqual([
|
|
{
|
|
name: '角色参考.png',
|
|
mediaType: 'image/png',
|
|
size: 12,
|
|
localPath: 'assets/uploads/upload-1-角色参考.png',
|
|
status: 'imported',
|
|
},
|
|
{
|
|
name: 'lost.bin',
|
|
mediaType: 'application/octet-stream',
|
|
size: 2,
|
|
status: 'failed',
|
|
},
|
|
]);
|
|
});
|
|
|
|
it('returns an empty list when there is nothing to map', () => {
|
|
expect(toDirectCodexTurnAttachments(undefined)).toEqual([]);
|
|
expect(toDirectCodexTurnAttachments([])).toEqual([]);
|
|
});
|
|
});
|