summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/commands/corgiCommand.test.ts
diff options
context:
space:
mode:
authorAbhi <[email protected]>2025-07-17 19:40:36 -0400
committerGitHub <[email protected]>2025-07-17 23:40:36 +0000
commitca07b5b0c41defb27d6b156faba356ab900ee092 (patch)
tree48a4c2180d6c7ddd70c14468a14b918812d5ba74 /packages/cli/src/ui/commands/corgiCommand.test.ts
parent5df6c9fb660f932d54d6b5d1080cb86c95a824cf (diff)
Migrate /corgi (#4419)
Diffstat (limited to 'packages/cli/src/ui/commands/corgiCommand.test.ts')
-rw-r--r--packages/cli/src/ui/commands/corgiCommand.test.ts34
1 files changed, 34 insertions, 0 deletions
diff --git a/packages/cli/src/ui/commands/corgiCommand.test.ts b/packages/cli/src/ui/commands/corgiCommand.test.ts
new file mode 100644
index 00000000..3c25e8cd
--- /dev/null
+++ b/packages/cli/src/ui/commands/corgiCommand.test.ts
@@ -0,0 +1,34 @@
+/**
+ * @license
+ * Copyright 2025 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+import { describe, it, expect, beforeEach, vi } from 'vitest';
+import { corgiCommand } from './corgiCommand.js';
+import { type CommandContext } from './types.js';
+import { createMockCommandContext } from '../../test-utils/mockCommandContext.js';
+
+describe('corgiCommand', () => {
+ let mockContext: CommandContext;
+
+ beforeEach(() => {
+ mockContext = createMockCommandContext();
+ vi.spyOn(mockContext.ui, 'toggleCorgiMode');
+ });
+
+ it('should call the toggleCorgiMode function on the UI context', async () => {
+ if (!corgiCommand.action) {
+ throw new Error('The corgi command must have an action.');
+ }
+
+ await corgiCommand.action(mockContext, '');
+
+ expect(mockContext.ui.toggleCorgiMode).toHaveBeenCalledTimes(1);
+ });
+
+ it('should have the correct name and description', () => {
+ expect(corgiCommand.name).toBe('corgi');
+ expect(corgiCommand.description).toBe('Toggles corgi mode.');
+ });
+});