Some checks failed
Deploy Development / deploy (push) Successful in 47s
Test Suite / pytest-backend (push) Failing after 1m46s
Test Suite / k6 /api/health Baseline (push) Has been skipped
Test Suite / playwright-smoke (push) Has been skipped
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Ersetzt die Vorhaben-Tab-Navigation durch Cockpit/Ausführen/Planen/Kontrolle/Team, Deep Links für APs/Projekte/Gates und Programm-Scope im Header. Co-authored-by: Cursor <cursoragent@cursor.com>
74 lines
2.8 KiB
JavaScript
74 lines
2.8 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.initiative_portfolio')
|
|
expect(keys).toContain('kairo.blocked_actions')
|
|
expect(keys).toContain('kairo.tenant_context')
|
|
expect(keys).toContain('kairo.workspace_summary')
|
|
expect(keys).toContain('kairo.next_actions')
|
|
expect(keys).toContain('kairo.workspace_today')
|
|
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(8)
|
|
|
|
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.initiative_portfolio')).toBe(true)
|
|
expect(readOnly.some((w) => w.key === 'kairo.attention')).toBe(false)
|
|
})
|
|
})
|
|
|
|
describe('viewRegistry', () => {
|
|
it('contains cockpit, work modes and initiatives catalog', () => {
|
|
const keys = VIEWS.map((v) => v.key)
|
|
expect(keys).toContain('kairo.cockpit')
|
|
expect(keys).toContain('kairo.work')
|
|
expect(keys).toContain('kairo.plan')
|
|
expect(keys).toContain('kairo.control')
|
|
expect(keys).toContain('kairo.team')
|
|
expect(keys).toContain('kairo.initiatives')
|
|
})
|
|
|
|
it('filters nav views by capability', () => {
|
|
const nav = getNavViews(['kairo.initiative.read'])
|
|
expect(nav.some((v) => v.key === 'kairo.cockpit')).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).toBeGreaterThanOrEqual(5)
|
|
expect(items[0].Icon).toBeTruthy()
|
|
})
|
|
|
|
it('highlights plan mode for project object route', () => {
|
|
const items = getAppNavItems(['kairo.action.read', 'kairo.initiative.read'])
|
|
const plan = items.find((i) => i.key === 'kairo.plan')
|
|
expect(isNavItemActive('/projects/abc-123', plan, false)).toBe(true)
|
|
})
|
|
|
|
it('highlights work mode for action object route', () => {
|
|
const items = getAppNavItems(['kairo.action.read', 'kairo.initiative.read'])
|
|
const work = items.find((i) => i.key === 'kairo.work')
|
|
expect(isNavItemActive('/actions/abc-123', work, false)).toBe(true)
|
|
})
|
|
})
|