Add Site Safety Assistant (ssa) role replacing reporter, supervisor and capa_owner. Portals move under /ssa (overview, my-reports, incidents, capas). Update RLS, schema, API role checks, notification recipients, nav and tests. Add db/ops/2026-11-06-merge-roles-into-ssa.sql (not yet applied; needs owner go-ahead and a pg_dump first). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
23 lines
981 B
TypeScript
23 lines
981 B
TypeScript
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 ssa', () => {
|
|
expect(navItemsFor('hse').map(i => i.label)).toEqual(['Dashboard', 'Incidents', 'CAPA', 'Settings'])
|
|
expect(navItemsFor('admin')[0].label).toBe('Admin')
|
|
expect(navItemsFor('nobody')).toEqual(navItemsFor('ssa'))
|
|
})
|
|
|
|
it('matches root pages exactly and nested pages by prefix', () => {
|
|
expect(isActivePath('/ssa', '/ssa')).toBe(true)
|
|
expect(isActivePath('/ssa', '/ssa/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('ssa')).toBe('/ssa/incidents')
|
|
})
|
|
})
|