Makelore 2.0 initial clean snapshot
This commit is contained in:
37
tests/unit/youth-plain-language-skill.test.ts
Normal file
37
tests/unit/youth-plain-language-skill.test.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { readdir, readFile } from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { BUNDLED_COURSE_SKILL_IDS } from '@electron/opencode/superpowers';
|
||||
import { projectTemplates } from '../../shared/project-config';
|
||||
|
||||
const projectRoot = process.cwd();
|
||||
const skillPath = path.join(projectRoot, '.opencode', 'skills', 'youth-plain-language', 'SKILL.md');
|
||||
|
||||
describe('youth plain language Skill', () => {
|
||||
it('contains the required audience, clarity, accuracy, error, and respect rules', async () => {
|
||||
const content = await readFile(skillPath, 'utf8');
|
||||
|
||||
expect(content).toContain('面向 10–16 岁青少年');
|
||||
expect(content).toContain('一句话只讲一件事');
|
||||
expect(content).toContain('先说它能做什么');
|
||||
expect(content).toContain('代码、命令、文件路径、接口名、字段名、错误原文和品牌名必须保持准确');
|
||||
expect(content).toContain('不评价学生本人');
|
||||
expect(content).toContain('不使用幼儿化或居高临下语气');
|
||||
});
|
||||
|
||||
it('is bundled and required by every current project Agent template', () => {
|
||||
expect(BUNDLED_COURSE_SKILL_IDS).toContain('youth-plain-language');
|
||||
expect(projectTemplates.flatMap((template) => template.agents).every(
|
||||
(agent) => agent.skillIds.includes('youth-plain-language'),
|
||||
)).toBe(true);
|
||||
});
|
||||
|
||||
it('is allowed by every bundled legacy Agent template', async () => {
|
||||
const agentDirectory = path.join(projectRoot, '.opencode', 'agent');
|
||||
const agentFiles = (await readdir(agentDirectory)).filter((name) => name.endsWith('.md'));
|
||||
const contents = await Promise.all(agentFiles.map((name) => readFile(path.join(agentDirectory, name), 'utf8')));
|
||||
|
||||
expect(agentFiles.length).toBeGreaterThan(0);
|
||||
expect(contents.every((content) => content.includes('youth-plain-language: allow'))).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user