summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks
diff options
context:
space:
mode:
Diffstat (limited to 'packages/cli/src/ui/hooks')
-rw-r--r--packages/cli/src/ui/hooks/slashCommandProcessor.test.ts36
-rw-r--r--packages/cli/src/ui/hooks/slashCommandProcessor.ts2
2 files changed, 30 insertions, 8 deletions
diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts
index 2d7a8ffd..399a923b 100644
--- a/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts
+++ b/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts
@@ -153,6 +153,7 @@ describe('useSlashCommandProcessor', () => {
getCheckpointingEnabled: vi.fn(() => true),
getBugCommand: vi.fn(() => undefined),
getSessionId: vi.fn(() => 'test-session-id'),
+ getIdeMode: vi.fn(() => false),
} as unknown as Config;
mockCorgiMode = vi.fn();
mockUseSessionStats.mockReturnValue({
@@ -237,7 +238,10 @@ describe('useSlashCommandProcessor', () => {
const mockLoader = async () => [newCommand];
// We create the instance outside the mock implementation.
- const commandServiceInstance = new ActualCommandService(mockLoader);
+ const commandServiceInstance = new ActualCommandService(
+ mockConfig,
+ mockLoader,
+ );
// This mock ensures the hook uses our pre-configured instance.
vi.mocked(CommandService).mockImplementation(
@@ -271,7 +275,10 @@ describe('useSlashCommandProcessor', () => {
});
const newCommand: SlashCommand = { name: 'test', action: mockAction };
const mockLoader = async () => [newCommand];
- const commandServiceInstance = new ActualCommandService(mockLoader);
+ const commandServiceInstance = new ActualCommandService(
+ mockConfig,
+ mockLoader,
+ );
vi.mocked(CommandService).mockImplementation(
() => commandServiceInstance,
);
@@ -301,7 +308,10 @@ describe('useSlashCommandProcessor', () => {
});
const newCommand: SlashCommand = { name: 'test', action: mockAction };
const mockLoader = async () => [newCommand];
- const commandServiceInstance = new ActualCommandService(mockLoader);
+ const commandServiceInstance = new ActualCommandService(
+ mockConfig,
+ mockLoader,
+ );
vi.mocked(CommandService).mockImplementation(
() => commandServiceInstance,
);
@@ -333,7 +343,10 @@ describe('useSlashCommandProcessor', () => {
});
const newCommand: SlashCommand = { name: 'test', action: mockAction };
const mockLoader = async () => [newCommand];
- const commandServiceInstance = new ActualCommandService(mockLoader);
+ const commandServiceInstance = new ActualCommandService(
+ mockConfig,
+ mockLoader,
+ );
vi.mocked(CommandService).mockImplementation(
() => commandServiceInstance,
);
@@ -360,7 +373,10 @@ describe('useSlashCommandProcessor', () => {
const newAuthCommand: SlashCommand = { name: 'auth', action: mockAction };
const mockLoader = async () => [newAuthCommand];
- const commandServiceInstance = new ActualCommandService(mockLoader);
+ const commandServiceInstance = new ActualCommandService(
+ mockConfig,
+ mockLoader,
+ );
vi.mocked(CommandService).mockImplementation(
() => commandServiceInstance,
);
@@ -386,7 +402,10 @@ describe('useSlashCommandProcessor', () => {
});
const newCommand: SlashCommand = { name: 'test', action: mockAction };
const mockLoader = async () => [newCommand];
- const commandServiceInstance = new ActualCommandService(mockLoader);
+ const commandServiceInstance = new ActualCommandService(
+ mockConfig,
+ mockLoader,
+ );
vi.mocked(CommandService).mockImplementation(
() => commandServiceInstance,
);
@@ -414,7 +433,10 @@ describe('useSlashCommandProcessor', () => {
};
const mockLoader = async () => [parentCommand];
- const commandServiceInstance = new ActualCommandService(mockLoader);
+ const commandServiceInstance = new ActualCommandService(
+ mockConfig,
+ mockLoader,
+ );
vi.mocked(CommandService).mockImplementation(
() => commandServiceInstance,
);
diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.ts
index 24758842..c1c65080 100644
--- a/packages/cli/src/ui/hooks/slashCommandProcessor.ts
+++ b/packages/cli/src/ui/hooks/slashCommandProcessor.ts
@@ -182,7 +182,7 @@ export const useSlashCommandProcessor = (
],
);
- const commandService = useMemo(() => new CommandService(), []);
+ const commandService = useMemo(() => new CommandService(config), [config]);
useEffect(() => {
const load = async () => {