Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

validate.test.ts

24 lines815 Bytes

1import { describe, expect, it } from 'vitest'
2import { validateSkill } from '../src/validate'
3​
4describe('validateSkill', () => {
5 it('passes a clean portable skill by default', () => {
6 expect(validateSkill({ name: 'my-skill', description: 'ok' }).ok).toBe(true)
7 })
8​
9 it('flags invalid portable names', () => {
10 const r = validateSkill({ name: 'My_Skill', description: 'x' })
11 expect(r.ok).toBe(false)
12 expect(r.issues[0]?.target).toBe('portable')
13 })
14​
15 it('flags Anthropic reserved names and XML tags', () => {
16 const r = validateSkill(
17 { name: 'claude-helper', description: 'has <b>tag</b>' },
18 { targets: ['anthropic'] },
19 )
20 const messages = r.issues.map((i) => i.message).join(' ')
21 expect(messages).toContain('anthropic')
22 expect(messages).toContain('XML')
23 })
24})