feat(design): add AppShell, MobileShell and the notifications drawer
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { navItemsFor, isActivePath, searchHrefFor } from '@/components/layout/nav-items'
|
||||
|
||||
describe('nav items', () => {
|
||||
it('returns the role menu and falls back to reporter', () => {
|
||||
expect(navItemsFor('hse').map(i => i.label)).toEqual(['Dashboard', 'Incidents', 'CAPA', 'Settings'])
|
||||
expect(navItemsFor('admin')[0].label).toBe('Admin')
|
||||
expect(navItemsFor('nobody')).toEqual(navItemsFor('reporter'))
|
||||
})
|
||||
|
||||
it('matches root pages exactly and nested pages by prefix', () => {
|
||||
expect(isActivePath('/reporter', '/reporter')).toBe(true)
|
||||
expect(isActivePath('/reporter', '/reporter/incidents/1')).toBe(false)
|
||||
expect(isActivePath('/hse/incidents', '/hse/incidents/abc')).toBe(true)
|
||||
})
|
||||
|
||||
it('offers the search box only to roles that have an incident list', () => {
|
||||
expect(searchHrefFor('hse')).toBe('/hse/incidents')
|
||||
expect(searchHrefFor('admin')).toBe('/hse/incidents')
|
||||
expect(searchHrefFor('supervisor')).toBe('/supervisor/incidents')
|
||||
expect(searchHrefFor('reporter')).toBeNull()
|
||||
expect(searchHrefFor('capa_owner')).toBeNull()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user