Skip to content

Commit 7776ee7

Browse files
committed
fix(cli): update command registry tests for compatibility
- Update bash-command.test.ts for new test patterns - Update command-args.test.ts for new test patterns - Minor updates to command-registry.ts
1 parent 46a7eec commit 7776ee7

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

cli/src/commands/__tests__/bash-command.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('bash command', () => {
3333
logoutMutation: {} as any,
3434
streamMessageIdRef: { current: null },
3535
addToQueue: mock(() => {}),
36-
clearMessages: mock(() => {}),
36+
resetRunState: mock(() => {}),
3737
saveToHistory: mock(() => {}),
3838
scrollToLatest: mock(() => {}),
3939
sendMessage: mock(async () => {}),
@@ -301,7 +301,7 @@ describe('bash command', () => {
301301
logoutMutation: {} as any,
302302
streamMessageIdRef: { current: null },
303303
addToQueue: mock(() => {}),
304-
clearMessages: mock(() => {}),
304+
resetRunState: mock(() => {}),
305305
saveToHistory: mock(() => {}),
306306
scrollToLatest: mock(() => {}),
307307
sendMessage: mock(async () => {}),

cli/src/commands/__tests__/command-args.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('command factory pattern', () => {
3030
logoutMutation: {} as RouterParams['logoutMutation'],
3131
streamMessageIdRef: { current: null },
3232
addToQueue: mock(() => {}),
33-
clearMessages: mock(() => {}),
33+
resetRunState: mock(() => {}),
3434
saveToHistory: mock(() => {}),
3535
scrollToLatest: mock(() => {}),
3636
sendMessage: mock(async () => {}),
@@ -214,22 +214,22 @@ describe('command factory pattern', () => {
214214

215215
const sendMessage = mock(async () => {})
216216
const setMessages = mock(() => {})
217-
const clearMessages = mock(() => {})
217+
const resetRunState = mock(() => {})
218218
const setCanProcessQueue = mock(() => {})
219219

220220
const params = createMockParams({
221221
inputValue: '/new hello world',
222222
sendMessage,
223223
setMessages,
224-
clearMessages,
224+
resetRunState,
225225
setCanProcessQueue,
226226
})
227227

228228
newCmd!.handler(params, 'hello world')
229229

230230
// Should clear messages
231231
expect(setMessages).toHaveBeenCalled()
232-
expect(clearMessages).toHaveBeenCalled()
232+
expect(resetRunState).toHaveBeenCalled()
233233

234234
// Should re-enable queue and send message
235235
expect(setCanProcessQueue).toHaveBeenCalledWith(true)
@@ -245,22 +245,22 @@ describe('command factory pattern', () => {
245245

246246
const sendMessage = mock(async () => {})
247247
const setMessages = mock(() => {})
248-
const clearMessages = mock(() => {})
248+
const resetRunState = mock(() => {})
249249
const setCanProcessQueue = mock(() => {})
250250

251251
const params = createMockParams({
252252
inputValue: '/new',
253253
sendMessage,
254254
setMessages,
255-
clearMessages,
255+
resetRunState,
256256
setCanProcessQueue,
257257
})
258258

259259
newCmd!.handler(params, '')
260260

261261
// Should clear messages
262262
expect(setMessages).toHaveBeenCalled()
263-
expect(clearMessages).toHaveBeenCalled()
263+
expect(resetRunState).toHaveBeenCalled()
264264

265265
// Should disable queue and NOT send message
266266
expect(setCanProcessQueue).toHaveBeenCalledWith(false)

cli/src/commands/command-registry.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export type RouterParams = {
3434
logoutMutation: UseMutationResult<boolean, Error, void, unknown>
3535
streamMessageIdRef: React.MutableRefObject<string | null>
3636
addToQueue: (message: string, attachments?: PendingAttachment[]) => void
37-
clearMessages: () => void
37+
resetRunState: () => void
3838
saveToHistory: (message: string) => void
3939
scrollToLatest: () => void
4040
sendMessage: SendMessageFn
@@ -315,7 +315,7 @@ export const COMMAND_REGISTRY: CommandDefinition[] = [
315315

316316
// Clear the conversation
317317
params.setMessages(() => [])
318-
params.clearMessages()
318+
params.resetRunState()
319319
params.saveToHistory(params.inputValue.trim())
320320
clearInput(params)
321321
params.stopStreaming()

0 commit comments

Comments
 (0)