summaryrefslogtreecommitdiff
path: root/packages/cli/src/services/prompt-processors/argumentProcessor.test.ts
diff options
context:
space:
mode:
authorAbhi <[email protected]>2025-08-17 00:02:54 -0400
committerGitHub <[email protected]>2025-08-17 04:02:54 +0000
commit33b9bdb11e9371dfa6891ba1be47a12b958f493d (patch)
tree46ac192df7dd2aeaf35cb5eef5c121bc5decada9 /packages/cli/src/services/prompt-processors/argumentProcessor.test.ts
parente7dbc607a598c5270507d0ce7d55a3c98dcb0c0c (diff)
feat(cli): Introduce arguments for shell execution in custom commands (#5966)
Diffstat (limited to 'packages/cli/src/services/prompt-processors/argumentProcessor.test.ts')
-rw-r--r--packages/cli/src/services/prompt-processors/argumentProcessor.test.ts62
1 files changed, 2 insertions, 60 deletions
diff --git a/packages/cli/src/services/prompt-processors/argumentProcessor.test.ts b/packages/cli/src/services/prompt-processors/argumentProcessor.test.ts
index 6af578a9..1a4c0c6b 100644
--- a/packages/cli/src/services/prompt-processors/argumentProcessor.test.ts
+++ b/packages/cli/src/services/prompt-processors/argumentProcessor.test.ts
@@ -4,69 +4,11 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import {
- DefaultArgumentProcessor,
- ShorthandArgumentProcessor,
-} from './argumentProcessor.js';
+import { DefaultArgumentProcessor } from './argumentProcessor.js';
import { createMockCommandContext } from '../../test-utils/mockCommandContext.js';
+import { describe, it, expect } from 'vitest';
describe('Argument Processors', () => {
- describe('ShorthandArgumentProcessor', () => {
- const processor = new ShorthandArgumentProcessor();
-
- it('should replace a single {{args}} instance', async () => {
- const prompt = 'Refactor the following code: {{args}}';
- const context = createMockCommandContext({
- invocation: {
- raw: '/refactor make it faster',
- name: 'refactor',
- args: 'make it faster',
- },
- });
- const result = await processor.process(prompt, context);
- expect(result).toBe('Refactor the following code: make it faster');
- });
-
- it('should replace multiple {{args}} instances', async () => {
- const prompt = 'User said: {{args}}. I repeat: {{args}}!';
- const context = createMockCommandContext({
- invocation: {
- raw: '/repeat hello world',
- name: 'repeat',
- args: 'hello world',
- },
- });
- const result = await processor.process(prompt, context);
- expect(result).toBe('User said: hello world. I repeat: hello world!');
- });
-
- it('should handle an empty args string', async () => {
- const prompt = 'The user provided no input: {{args}}.';
- const context = createMockCommandContext({
- invocation: {
- raw: '/input',
- name: 'input',
- args: '',
- },
- });
- const result = await processor.process(prompt, context);
- expect(result).toBe('The user provided no input: .');
- });
-
- it('should not change the prompt if {{args}} is not present', async () => {
- const prompt = 'This is a static prompt.';
- const context = createMockCommandContext({
- invocation: {
- raw: '/static some arguments',
- name: 'static',
- args: 'some arguments',
- },
- });
- const result = await processor.process(prompt, context);
- expect(result).toBe('This is a static prompt.');
- });
- });
-
describe('DefaultArgumentProcessor', () => {
const processor = new DefaultArgumentProcessor();