forked from garrytan/gstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenclaw-native-skills.test.ts
More file actions
35 lines (30 loc) · 1.32 KB
/
Copy pathopenclaw-native-skills.test.ts
File metadata and controls
35 lines (30 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { describe, test, expect } from 'bun:test';
import * as fs from 'fs';
import * as path from 'path';
const ROOT = path.resolve(import.meta.dir, '..');
const OPENCLAW_NATIVE_SKILLS = [
'openclaw/skills/gstack-openclaw-investigate/SKILL.md',
'openclaw/skills/gstack-openclaw-office-hours/SKILL.md',
'openclaw/skills/gstack-openclaw-ceo-review/SKILL.md',
'openclaw/skills/gstack-openclaw-retro/SKILL.md',
];
function extractFrontmatter(content: string): string {
expect(content.startsWith('---\n')).toBe(true);
const fmEnd = content.indexOf('\n---', 4);
expect(fmEnd).toBeGreaterThan(0);
return content.slice(4, fmEnd);
}
describe('OpenClaw native skills', () => {
test('frontmatter parses as YAML and keeps only name + description', () => {
for (const skill of OPENCLAW_NATIVE_SKILLS) {
const content = fs.readFileSync(path.join(ROOT, skill), 'utf-8');
const frontmatter = extractFrontmatter(content);
const parsed = Bun.YAML.parse(frontmatter) as Record<string, unknown>;
expect(Object.keys(parsed).sort()).toEqual(['description', 'name']);
expect(typeof parsed.name).toBe('string');
expect(typeof parsed.description).toBe('string');
expect((parsed.name as string).length).toBeGreaterThan(0);
expect((parsed.description as string).length).toBeGreaterThan(0);
}
});
});