mirror of
https://github.com/stablyai/orca.git
synced 2026-11-15 18:37:24 +00:00
35 lines
1.0 KiB
TypeScript
35 lines
1.0 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.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'
|
|
})
|
|
}
|
|
})
|