Open History to see the last commit
1import { describe, expect, it } from 'vitest'
2import {
3 applySkillsSnapshot,
4 createSkillsRegistryState,
5} from '../src/store/skills-registry'
6
7describe('skills-registry', () => {
8 it('stores a catalog snapshot by hookId', () => {
9 const state = createSkillsRegistryState()
10 applySkillsSnapshot(state, {
11 hookId: 'hook-1',
12 catalog: [{ name: 'pirate-speak', description: 'talk like a pirate' }],
13 activated: [],
14 timestamp: 1,
15 })
16 expect(state.snapshots['hook-1']?.catalog).toEqual([
17 { name: 'pirate-speak', description: 'talk like a pirate' },
18 ])
19 })
20
21 it('buckets a missing hookId under _default', () => {
22 const state = createSkillsRegistryState()
23 applySkillsSnapshot(state, {
24 catalog: [{ name: 'haiku', description: 'short poems' }],
25 activated: ['haiku'],
26 })
27 expect(state.snapshots['_default']?.activated).toEqual(['haiku'])
28 })
29})