* add gated codex goals support * sync README SDK versions * bump claude agent sdk * add codex goals settings toggle * reuse status dashboard message and simplify settings actions * refine settings page UX * fix settings nav hash routing * add dashboard UX verification * refine dashboard settings and inbox UX * remove inbox top-level navigation * remove dashboard health top-level navigation * fix: allow runtime image attachment paths * feat: configure attachment allowlist dirs * fix: clean duplicate dashboard status messages * fix: poll dashboard duplicate cleanup between status updates * fix: delete dashboard duplicates on create * Refine settings IA with tabbed sections * Add read-only runtime inventory settings * Fix runtime inventory MCP JSON parsing * Add room skill settings inventory * Add room skill setting mutations * Apply room skill overrides to runner spawn * Refine scheduled task dashboard UX * Remove reviewer final prompt reinjection * Stabilize pnpm verification fixture * Remove previous owner final prompt carryover * Clear role-scoped sessions
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
|
|
const db = vi.hoisted(() => ({
|
|
assignRoom: vi.fn(),
|
|
deleteAllSessionsForGroup: vi.fn(),
|
|
deleteSession: vi.fn(),
|
|
getAllRoomBindings: vi.fn(() => ({})),
|
|
getAllSessions: vi.fn(() => ({})),
|
|
getRouterState: vi.fn(() => ''),
|
|
setRouterState: vi.fn(),
|
|
setSession: vi.fn(),
|
|
}));
|
|
|
|
vi.mock('./db.js', () => db);
|
|
|
|
import { createRuntimeState } from './runtime-state.js';
|
|
|
|
describe('createRuntimeState', () => {
|
|
beforeEach(() => {
|
|
vi.clearAllMocks();
|
|
});
|
|
|
|
it('clears role-scoped sessions from memory when allRoles is requested', () => {
|
|
const state = createRuntimeState();
|
|
|
|
state.persistSession('group-a', 'owner-session');
|
|
state.persistSession('group-a:reviewer', 'reviewer-session');
|
|
state.persistSession('group-a:arbiter', 'arbiter-session');
|
|
state.persistSession('group-b', 'other-session');
|
|
|
|
state.clearSession('group-a', { allRoles: true });
|
|
|
|
expect(state.getSessions()).toEqual({ 'group-b': 'other-session' });
|
|
expect(db.deleteAllSessionsForGroup).toHaveBeenCalledWith('group-a');
|
|
expect(db.deleteSession).not.toHaveBeenCalled();
|
|
});
|
|
});
|