All checks were successful
Deploy Development / deploy (push) Successful in 45s
Test Suite / pytest-backend (push) Successful in 57s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 18s
Test Suite / playwright-smoke (push) Successful in 12s
Attention-Widget an workspace.read koppeln, Vorhaben-Detail-Sektionen bei initiative.read anzeigen, App-Version im Kontext-Widget, Session-Loading-Race behoben. Co-authored-by: Cursor <cursoragent@cursor.com>
65 lines
2.3 KiB
JavaScript
65 lines
2.3 KiB
JavaScript
import { describe, expect, it } from 'vitest'
|
|
import { WIDGETS, getWidgetsForArea } from '../registry/widgetRegistry.js'
|
|
import { VIEWS, getNavViews } from '../registry/viewRegistry.js'
|
|
import { getAppNavItems, isNavItemActive } from '../config/appNav.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')
|
|
expect(keys).toContain('kairo.workspace_summary')
|
|
expect(keys).toContain('kairo.attention')
|
|
})
|
|
|
|
it('filters widgets by capability', () => {
|
|
const all = getWidgetsForArea('workspace', [
|
|
'kairo.action.read',
|
|
'kairo.initiative.read',
|
|
'kairo.workspace.read',
|
|
])
|
|
expect(all.length).toBe(6)
|
|
|
|
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)
|
|
expect(readOnly.some((w) => w.key === 'kairo.attention')).toBe(false)
|
|
})
|
|
})
|
|
|
|
describe('viewRegistry', () => {
|
|
it('contains workspace, initiatives and my actions views', () => {
|
|
const keys = VIEWS.map((v) => v.key)
|
|
expect(keys).toContain('kairo.workspace')
|
|
expect(keys).toContain('kairo.initiatives')
|
|
expect(keys).toContain('kairo.my_actions')
|
|
})
|
|
|
|
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)
|
|
})
|
|
})
|
|
|
|
describe('appNav', () => {
|
|
it('maps views to nav items with icons', () => {
|
|
const items = getAppNavItems([
|
|
'kairo.action.read',
|
|
'kairo.initiative.read',
|
|
])
|
|
expect(items.length).toBe(3)
|
|
expect(items[0].Icon).toBeTruthy()
|
|
})
|
|
|
|
it('highlights initiatives for detail route', () => {
|
|
const items = getAppNavItems(['kairo.action.read', 'kairo.initiative.read'])
|
|
const initiatives = items.find((i) => i.key === 'kairo.initiatives')
|
|
expect(
|
|
isNavItemActive('/initiatives/abc-123', initiatives, false),
|
|
).toBe(true)
|
|
})
|
|
})
|