40 lines
1.4 KiB
JavaScript
40 lines
1.4 KiB
JavaScript
|
|
import { describe, expect, it } from 'vitest'
|
||
|
|
import { WIDGETS, getWidgetsForArea } from '../registry/widgetRegistry.js'
|
||
|
|
import { VIEWS, getNavViews } from '../registry/viewRegistry.js'
|
||
|
|
|
||
|
|
describe('widgetRegistry', () => {
|
||
|
|
it('contains expected AP0.6 widgets', () => {
|
||
|
|
const keys = WIDGETS.map((w) => w.key)
|
||
|
|
expect(keys).toContain('kairo.my_open_actions')
|
||
|
|
expect(keys).toContain('kairo.active_initiatives')
|
||
|
|
expect(keys).toContain('kairo.blocked_actions')
|
||
|
|
expect(keys).toContain('kairo.tenant_context')
|
||
|
|
})
|
||
|
|
|
||
|
|
it('filters widgets by capability', () => {
|
||
|
|
const all = getWidgetsForArea('workspace', [
|
||
|
|
'kairo.action.read',
|
||
|
|
'kairo.initiative.read',
|
||
|
|
])
|
||
|
|
expect(all.length).toBe(4)
|
||
|
|
|
||
|
|
const readOnly = getWidgetsForArea('workspace', ['kairo.initiative.read'])
|
||
|
|
expect(readOnly.some((w) => w.key === 'kairo.my_open_actions')).toBe(false)
|
||
|
|
expect(readOnly.some((w) => w.key === 'kairo.active_initiatives')).toBe(true)
|
||
|
|
})
|
||
|
|
})
|
||
|
|
|
||
|
|
describe('viewRegistry', () => {
|
||
|
|
it('contains workspace and initiatives views', () => {
|
||
|
|
const keys = VIEWS.map((v) => v.key)
|
||
|
|
expect(keys).toContain('kairo.workspace')
|
||
|
|
expect(keys).toContain('kairo.initiatives')
|
||
|
|
})
|
||
|
|
|
||
|
|
it('filters nav views by capability', () => {
|
||
|
|
const nav = getNavViews(['kairo.initiative.read'])
|
||
|
|
expect(nav.some((v) => v.key === 'kairo.workspace')).toBe(false)
|
||
|
|
expect(nav.some((v) => v.key === 'kairo.initiatives')).toBe(true)
|
||
|
|
})
|
||
|
|
})
|