| 18 | */ |
| 19 | describe('command factory pattern', () => { |
| 20 | const createMockParams = ( |
| 21 | overrides: Partial<RouterParams> = {}, |
| 22 | ): RouterParams => |
| 23 | ({ |
| 24 | abortControllerRef: { current: null }, |
| 25 | agentMode: 'DEFAULT', |
| 26 | inputRef: { current: null }, |
| 27 | inputValue: '/test', |
| 28 | isChainInProgressRef: { current: false }, |
| 29 | isStreaming: false, |
| 30 | logoutMutation: {} as RouterParams['logoutMutation'], |
| 31 | streamMessageIdRef: { current: null }, |
| 32 | addToQueue: mock(() => {}), |
| 33 | clearMessages: mock(() => {}), |
| 34 | saveToHistory: mock(() => {}), |
| 35 | scrollToLatest: mock(() => {}), |
| 36 | sendMessage: mock(async () => {}), |
| 37 | setCanProcessQueue: mock(() => {}), |
| 38 | setInputFocused: mock(() => {}), |
| 39 | setInputValue: mock(() => {}), |
| 40 | setIsAuthenticated: mock(() => {}), |
| 41 | setMessages: mock(() => {}), |
| 42 | setUser: mock(() => {}), |
| 43 | stopStreaming: mock(() => {}), |
| 44 | ...overrides, |
| 45 | }) as RouterParams |
| 46 | |
| 47 | describe('defineCommand (gracefully ignores args)', () => { |
| 48 | test('calls handler when no args provided', () => { |