summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/commands/helpCommand.test.ts
diff options
context:
space:
mode:
authorAbhi <[email protected]>2025-07-07 16:45:44 -0400
committerGitHub <[email protected]>2025-07-07 20:45:44 +0000
commitaa10ccba713d49bef6bf474bfd72c0852e3da611 (patch)
tree92f1de8bec31cdb10a02fe8ddac1fbde41b75e7f /packages/cli/src/ui/commands/helpCommand.test.ts
parent6eccb474c77e41aa88d1d1d4ea7eada3e85e746c (diff)
feature(commands) - Refactor Slash Command + Vision For the Future (#3175)
Diffstat (limited to 'packages/cli/src/ui/commands/helpCommand.test.ts')
-rw-r--r--packages/cli/src/ui/commands/helpCommand.test.ts40
1 files changed, 40 insertions, 0 deletions
diff --git a/packages/cli/src/ui/commands/helpCommand.test.ts b/packages/cli/src/ui/commands/helpCommand.test.ts
new file mode 100644
index 00000000..a6b19c05
--- /dev/null
+++ b/packages/cli/src/ui/commands/helpCommand.test.ts
@@ -0,0 +1,40 @@
+/**
+ * @license
+ * Copyright 2025 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+import { vi, describe, it, expect, beforeEach } from 'vitest';
+import { helpCommand } from './helpCommand.js';
+import { type CommandContext } from './types.js';
+
+describe('helpCommand', () => {
+ let mockContext: CommandContext;
+
+ beforeEach(() => {
+ mockContext = {} as unknown as CommandContext;
+ });
+
+ it("should return a dialog action and log a debug message for '/help'", () => {
+ const consoleDebugSpy = vi
+ .spyOn(console, 'debug')
+ .mockImplementation(() => {});
+ if (!helpCommand.action) {
+ throw new Error('Help command has no action');
+ }
+ const result = helpCommand.action(mockContext, '');
+
+ expect(result).toEqual({
+ type: 'dialog',
+ dialog: 'help',
+ });
+ expect(consoleDebugSpy).toHaveBeenCalledWith('Opening help UI ...');
+ });
+
+ it("should also be triggered by its alternative name '?'", () => {
+ // This test is more conceptual. The routing of altName to the command
+ // is handled by the slash command processor, but we can assert the
+ // altName is correctly defined on the command object itself.
+ expect(helpCommand.altName).toBe('?');
+ });
+});