2026-09-02 17:30:18 +07:00
|
|
|
import type { AppHooks } from '../src/ui/App';
|
|
|
|
|
|
|
|
|
|
/** Default AppHooks for UI tests; override only what a test cares about. */
|
|
|
|
|
export function testHooks(over: Partial<AppHooks> = {}): AppHooks {
|
|
|
|
|
return {
|
|
|
|
|
sessionId: 'test1234',
|
|
|
|
|
config: () => ({ provider: 'openai', model: 'gpt-5' }),
|
|
|
|
|
switchModel: (id) => `model is now ${id}`,
|
|
|
|
|
switchAgent: (name) => `agent is now ${name}`,
|
|
|
|
|
switchThinking: (level) => `thinking is now ${level}`,
|
|
|
|
|
agentName: () => 'default',
|
|
|
|
|
thinkingLevel: () => 'medium',
|
|
|
|
|
applyProvider: async () => 'configured',
|
|
|
|
|
listModels: async () => ({ models: [] }),
|
|
|
|
|
listSessions: async () => 'no saved sessions',
|
|
|
|
|
listSkills: () => 'no skills loaded',
|
|
|
|
|
listPlugins: () => 'no plugins active',
|
|
|
|
|
listMemory: async () => 'nothing remembered yet',
|
|
|
|
|
summarizeMemory: async () => 'nothing to compact',
|
|
|
|
|
resumeSession: async () => 'resumed',
|
|
|
|
|
saveSession: async () => 'saved',
|
|
|
|
|
instructionFiles: () => [],
|
2026-09-03 01:37:48 +07:00
|
|
|
listPaths: async () => [],
|
2026-09-03 03:07:56 +07:00
|
|
|
registry: {
|
|
|
|
|
list: async () => [],
|
|
|
|
|
installed: async () => [],
|
|
|
|
|
stage: async () => {
|
|
|
|
|
throw new Error('no registry in tests unless a test provides one');
|
|
|
|
|
},
|
|
|
|
|
install: async () => 'installed',
|
|
|
|
|
remove: async () => 'removed',
|
|
|
|
|
},
|
2026-09-02 17:30:18 +07:00
|
|
|
initPrompt: 'write AGENTS.md',
|
|
|
|
|
history: [],
|
|
|
|
|
recordPrompt: () => {},
|
2026-09-04 17:34:37 +07:00
|
|
|
listUserCommands: () => [],
|
|
|
|
|
expandUserCommand: async (name) => {
|
|
|
|
|
throw new Error(`no custom command "${name}" in tests`);
|
|
|
|
|
},
|
2026-09-02 17:30:18 +07:00
|
|
|
...over,
|
|
|
|
|
};
|
|
|
|
|
}
|