5cd02aa8b0
Project CI / AI game creator shell Rust shard 3/4 (pull_request) Failing after 2m44s
Project CI / AI game creator shell Rust shard 1/4 (pull_request) Failing after 2m45s
Project CI / AI game creator shell Rust shard 2/4 (pull_request) Failing after 2m46s
Project CI / AI game creator shell Rust shard 4/4 (pull_request) Failing after 2m49s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m53s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 3m18s
Project CI / Frontend tests (pull_request) Failing after 4m6s
Project CI / Native shell tests (pull_request) Successful in 6m12s
Project CI / Repository checks (pull_request) Failing after 3m48s
Project CI / Backend tests (pull_request) Successful in 7m8s
Project CI / AI game creator shell web tests (pull_request) Failing after 3m59s
当前Agent与策划Agent共用正文和过程表现组件,统一思考及工具调用的小字号浅色样式 素材工具栏按实际动作分组,导出紧邻删除并修复空分组重复分隔线 文档与代码使用共享Markdown预览和代码高亮,复用按需读取与缓存 移除未调用的活跃回合查询命令,保留正式快照恢复链路 补充回归用例并同步技术方案和团队约定
75 lines
2.1 KiB
TypeScript
75 lines
2.1 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import {
|
|
isResourceDocumentPreviewable,
|
|
resourceDocumentPreviewMarkdown,
|
|
} from '../src/features/resource-canvas/resourceDocumentPreviewModel';
|
|
import type { ProjectResource } from '../src/view/project-development/resourceProjectionModel';
|
|
|
|
function resource(path: string): ProjectResource {
|
|
return {
|
|
id: path,
|
|
path,
|
|
label: path,
|
|
mediaType: 'text/plain',
|
|
category: 'document',
|
|
subtype: 'document',
|
|
manifestAssetId: 'doc',
|
|
sourceLabel: '',
|
|
taskTitle: null,
|
|
producerTaskId: null,
|
|
externalResourceId: null,
|
|
referenceResourceIds: [],
|
|
dependencies: [],
|
|
dependencyDepth: 0,
|
|
};
|
|
}
|
|
|
|
describe('resourceDocumentPreviewMarkdown', () => {
|
|
it('文档与空行原样进入 Markdown 渲染', () => {
|
|
const text = '# 标题\n\n\n|列|\n|-|\n|值|';
|
|
expect(
|
|
resourceDocumentPreviewMarkdown(resource('docs/design.md'), text),
|
|
).toBe(text);
|
|
expect(isResourceDocumentPreviewable(resource('docs/design.md'))).toBe(
|
|
true,
|
|
);
|
|
});
|
|
|
|
it.each([
|
|
['game/main.ts', 'typescript'],
|
|
['game/main.js', 'javascript'],
|
|
['assets/data.json', 'json'],
|
|
['game/main.py', 'python'],
|
|
])('%s 包为 %s 代码块', (path, language) => {
|
|
expect(
|
|
resourceDocumentPreviewMarkdown(resource(path), ' source\n\n\n'),
|
|
).toBe(`\`\`\`${language}\n source\n\n\n\`\`\``);
|
|
});
|
|
|
|
it('正文包含 Markdown 围栏时不会逃出代码块', () => {
|
|
const text = 'const sample = "````";\n\n\n<script>alert(1)</script>';
|
|
expect(
|
|
resourceDocumentPreviewMarkdown(resource('game/main.js'), text),
|
|
).toBe(`\`\`\`\`\`javascript\n${text}\n\`\`\`\`\``);
|
|
});
|
|
|
|
it('图片没有文档预览入口,内联文档不要求文件路径', () => {
|
|
expect(
|
|
isResourceDocumentPreviewable({
|
|
...resource('assets/image.png'),
|
|
mediaType: 'image/png',
|
|
subtype: 'image',
|
|
}),
|
|
).toBe(false);
|
|
expect(
|
|
isResourceDocumentPreviewable({
|
|
...resource(''),
|
|
content: '# 回执',
|
|
subtype: 'agent-result',
|
|
}),
|
|
).toBe(true);
|
|
expect(isResourceDocumentPreviewable(resource(''))).toBe(false);
|
|
});
|
|
});
|