Files
orca/src/shared/skill-metadata.test.ts
T
PPP-JHandm4air 16d1ab81d3 perf(skills): bound WSL installed skill discovery (#12314)
* perf(skills): bound WSL installed skill discovery

* fix(skills): preserve bounded discovery correctness

* fix(skills): bound WSL metadata prefilter reads

* fix(skills): isolate absent discovery cwd cache keys

* test(skills): adapt WSL discovery mocks to runner

* fix(skills): preserve filtered discovery fallbacks

* fix(skills): share filtered scans and preserve WSL inventory

* fix(skills): share WSL scans without losing skill aliases

* fix: preserve skill metadata and retire filtered peer caches

---------

Co-authored-by: m4air <m4air@Mac.localdomain>
2026-09-13 19:16:42 -07:00

47 lines
1.4 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { summarizeSkillMarkdown } from './skill-metadata'
describe('summarizeSkillMarkdown', () => {
it('reads name and folded description from YAML frontmatter', () => {
const summary = summarizeSkillMarkdown(`---
name: orca-cli
description: >-
Use the orca CLI to drive a running editor;
keep worktree comments current.
---
# Orca CLI
`)
expect(summary).toEqual({
name: 'orca-cli',
description: 'Use the orca CLI to drive a running editor; keep worktree comments current.'
})
})
it('falls back to heading and first paragraph when frontmatter is absent', () => {
const summary = summarizeSkillMarkdown(`# Design Review
Use when reviewing UI implementation quality.
`)
expect(summary).toEqual({
name: 'Design Review',
description: 'Use when reviewing UI implementation quality.'
})
})
})
it.each(['', '\uFEFF'])('preserves the last CRLF frontmatter field with BOM %j', (bom) => {
for (const fields of [
['name: actual-name', 'description: actual description'],
['description: actual description', 'name: actual-name']
]) {
const markdown = `${bom}${['---', ...fields, '---', '# Fallback heading', '', 'Fallback paragraph'].join('\r\n')}`
expect(summarizeSkillMarkdown(markdown)).toEqual({
name: 'actual-name',
description: 'actual description'
})
}
})