test(cli): cover acp slash command allowlist

This commit is contained in:
yiliang114 2026-03-22 15:41:18 +08:00
parent 3b08491e46
commit 3209274ab6

View file

@ -5,7 +5,10 @@
*/
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { handleSlashCommand } from './nonInteractiveCliCommands.js';
import {
ALLOWED_BUILTIN_COMMANDS_ACP,
handleSlashCommand,
} from './nonInteractiveCliCommands.js';
import type { Config } from '@qwen-code/qwen-code-core';
import type { LoadedSettings } from './config/settings.js';
import { CommandKind } from './ui/commands/types.js';
@ -60,6 +63,12 @@ describe('handleSlashCommand', () => {
expect(result.type).toBe('no_command');
});
it('should keep the ACP allowlist commands needed by VSCode companion', () => {
expect(ALLOWED_BUILTIN_COMMANDS_ACP).toEqual(
expect.arrayContaining(['bug', 'compress', 'summary', 'insight']),
);
});
it('should return no_command for unknown slash commands', async () => {
mockGetCommands.mockReturnValue([]);