返回 oh-my-ppt
style-import-prompt.test.ts
根目录 / tests / unit / agent-runtime / style-import-prompt.test.ts
1 import { describe, expect, it } from 'vitest'
2 import {
3 buildStyleImageImportPrompt,
4 buildStyleImportPrompt,
5 buildStylePptxImportPrompt,
6 buildStylePreviewPrompt
7 } from '../../../src/main/agent-runtime/prompt'
8
9 describe('style import prompt composers', () => {
10 it('loads static image-analysis instructions from Markdown', () => {
11 const prompt = buildStyleImageImportPrompt()
12
13 expect(prompt).toContain('PPT 风格提取专家')
14 expect(prompt).toContain('Anime.js v4 兼容')
15 expect(prompt).toContain('aliases 至少 2 个')
16 expect(prompt).not.toMatch(/\{\{[^}]+\}\}/)
17 })
18
19 it('adds the file path and category guide to text-style analysis', () => {
20 const prompt = buildStyleImportPrompt('/uploaded/style.md')
21
22 expect(prompt).toContain('- 浅色 · 沉静 => light-calm')
23 expect(prompt).toContain('- 活力 · 创意 => vibrant-creative')
24 expect(prompt).toContain('读取文件路径:/uploaded/style.md')
25 expect(prompt).toContain('分段多次 read_file 后再总结')
26 })
27
28 it('adds the selected pages to PPTX-style analysis', () => {
29 const prompt = buildStylePptxImportPrompt({
30 deckRootPath: '/deck',
31 indexPath: '/deck/index.html',
32 samplePagePaths: ['/deck/page-1.html', '/deck/page-3.html']
33 })
34
35 expect(prompt).toContain('读取根目录:\n/deck')
36 expect(prompt).toContain('- /deck/index.html')
37 expect(prompt).toContain('- /deck/page-1.html\n- /deck/page-3.html')
38 expect(prompt).toContain('优先使用 grep/read_file 中出现的真实颜色和字体')
39 })
40
41 it('loads the standalone preview workflow from Markdown', () => {
42 const prompt = buildStylePreviewPrompt()
43
44 expect(prompt).toContain('Use write_file to create /preview.html.')
45 expect(prompt).toContain('fixed 1600x900 presentation canvas')
46 expect(prompt).toContain('Do not modify style.json or SKILL.md.')
47 expect(prompt).not.toMatch(/\{\{[^}]+\}\}/)
48 })
49 })
50
50 lines TYPESCRIPT