CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes45downloads
argumentProcessor.test.ts44 linesDownload Raw Back to prompt-processors
1/**2 * @license3 * Copyright 2025 Google LLC4 * SPDX-License-Identifier: Apache-2.05 */6 7import { DefaultArgumentProcessor } from './argumentProcessor.js';8import { createMockCommandContext } from '../../test-utils/mockCommandContext.js';9import { describe, it, expect } from 'vitest';10 11describe('Argument Processors', () => {12  describe('DefaultArgumentProcessor', () => {13    const processor = new DefaultArgumentProcessor();14 15    it('should append the full command if args are provided', async () => {16      const prompt = [{ text: 'Parse the command.' }];17      const context = createMockCommandContext({18        invocation: {19          raw: '/mycommand arg1 "arg two"',20          name: 'mycommand',21          args: 'arg1 "arg two"',22        },23      });24      const result = await processor.process(prompt, context);25      expect(result).toEqual([26        { text: 'Parse the command.\n\n/mycommand arg1 "arg two"' },27      ]);28    });29 30    it('should NOT append the full command if no args are provided', async () => {31      const prompt = [{ text: 'Parse the command.' }];32      const context = createMockCommandContext({33        invocation: {34          raw: '/mycommand',35          name: 'mycommand',36          args: '',37        },38      });39      const result = await processor.process(prompt, context);40      expect(result).toEqual([{ text: 'Parse the command.' }]);41    });42  });43});44 
basant307/AI_Governance_Project · CoolFace