feat: add tests and update mds

This commit is contained in:
Brooklyn Nicholson 2026-04-08 19:31:25 -05:00
parent f226e6be10
commit 9d8f9765c1
11 changed files with 6013 additions and 4 deletions

View file

@ -0,0 +1,43 @@
import { describe, expect, it } from 'vitest'
import { FACES, HOTKEYS, INTERPOLATION_RE, PLACEHOLDERS, ROLE, TOOL_VERBS, VERBS, ZERO } from '../constants.js'
import { DEFAULT_THEME } from '../theme.js'
describe('constants', () => {
it('ZERO', () => expect(ZERO).toEqual({ calls: 0, input: 0, output: 0, total: 0 }))
it('string arrays are populated', () => {
for (const arr of [FACES, PLACEHOLDERS, VERBS]) {
expect(arr.length).toBeGreaterThan(0)
arr.forEach(s => expect(typeof s).toBe('string'))
}
})
it('HOTKEYS are [key, desc] pairs', () => {
HOTKEYS.forEach(([k, d]) => {
expect(typeof k).toBe('string')
expect(typeof d).toBe('string')
})
})
it('TOOL_VERBS maps known tools', () => {
expect(TOOL_VERBS.terminal).toContain('terminal')
expect(TOOL_VERBS.read_file).toContain('reading')
})
it('INTERPOLATION_RE matches {!cmd}', () => {
INTERPOLATION_RE.lastIndex = 0
expect(INTERPOLATION_RE.test('{!date}')).toBe(true)
INTERPOLATION_RE.lastIndex = 0
expect(INTERPOLATION_RE.test('plain')).toBe(false)
})
it('ROLE produces glyph/body/prefix per role', () => {
for (const role of ['assistant', 'system', 'tool', 'user'] as const) {
expect(ROLE[role](DEFAULT_THEME)).toHaveProperty('glyph')
}
})
})