Rebuild the participant flow around the agent itself: - Phases: Team registration (+ agent name) -> Meet your agent -> Skills & Policies (edit the agent's makeup) -> UnoQ Dashboard (React Flow configurator) -> Submit. Swapped/renamed the two module pages (Module1/2 -> ModuleDashboard/ModuleMakeup). - Agent name captured at registration, shown on the dashboard and used in the chat greeting (live, not hard-coded), pushed to the board. - One shared conversation across pages (AgentChatContext); Clawd the crab animates the LED matrix and reacts to chat status. - MAKEUP slide-outs: view, edit (wrench), or AI-refine (wand) the agent's personality files and save them back to the board. - Advance button moved into the sidebar for every phase (ProceedContext). - Dropped the ADD-doc build + submission gate; Submit just records the entry. - Responsive pass: sidebar auto-collapses below lg, fluid padding, React Flow pan/zoom/fit + Controls, architecture panel becomes a mobile overlay. - Add @xyflow/react for the configurator. Co-Authored-By: Claude Opus 4.8 <[email protected]>
51 lines
1.9 KiB
TypeScript
51 lines
1.9 KiB
TypeScript
import { describe, it, expect, beforeEach } from 'vitest'
|
|
import { useSession } from './session'
|
|
|
|
describe('session store · teamId', () => {
|
|
beforeEach(() => {
|
|
sessionStorage.clear()
|
|
})
|
|
|
|
it('has a non-empty stable team id', () => {
|
|
const id = useSession.getState().teamId
|
|
expect(id).toBeTruthy()
|
|
expect(typeof id).toBe('string')
|
|
})
|
|
|
|
it('defaults device.nodeUrl to null and lets a claim set it', () => {
|
|
expect(useSession.getState().device.nodeUrl).toBeNull()
|
|
useSession.getState().setDevice({ connected: true, nodeUrl: 'http://192.168.1.7:8080' })
|
|
expect(useSession.getState().device.nodeUrl).toBe('http://192.168.1.7:8080')
|
|
useSession.getState().reset()
|
|
expect(useSession.getState().device.nodeUrl).toBeNull()
|
|
})
|
|
|
|
it('preserves the team id across reset()', () => {
|
|
const before = useSession.getState().teamId
|
|
useSession.getState().setTeam({ name: 'x' })
|
|
useSession.getState().reset()
|
|
expect(useSession.getState().teamId).toBe(before)
|
|
expect(useSession.getState().team.name).toBe('')
|
|
})
|
|
|
|
it('resumeTeam adopts the canonical identity + restores progress (lost-browser re-claim)', () => {
|
|
// a fresh browser: random id, empty team
|
|
expect(useSession.getState().team.name).toBe('')
|
|
useSession.getState().resumeTeam({
|
|
id: 'team-07',
|
|
name: 'team_resonance',
|
|
kit: 'KIT-07',
|
|
members: ['ada', 'linus'],
|
|
phases: { reg: true, setup: true, m1: false, m2: false, add: false },
|
|
stats: { calls: 9, nominal: 5, anomalous: 3, critical: 1 },
|
|
})
|
|
const s = useSession.getState()
|
|
expect(s.teamId).toBe('team-07') // adopted the board's canonical team, not the fresh id
|
|
expect(s.team).toEqual({ name: 'team_resonance', agentName: '', kit: 'KIT-07', members: ['ada', 'linus'] })
|
|
expect(s.phases.reg).toBe(true)
|
|
expect(s.phases.setup).toBe(true)
|
|
expect(s.stats.calls).toBe(9)
|
|
expect(s.device.connected).toBe(true) // back on the board
|
|
})
|
|
})
|