Files
hapi/cli/src/codex/codexSpecialCommands.test.ts
T
NightWatcher314andGitHub a612be50d6 Add Codex clear and compact slash commands (#541)
* Add Codex clear and compact slash commands

* Stabilize queued thinking event test

* Interrupt active Codex turn before slash commands
2026-04-29 14:15:44 +08:00

28 lines
1.1 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { parseCodexSpecialCommand } from './codexSpecialCommands';
describe('parseCodexSpecialCommand', () => {
it('accepts exact /clear and /compact commands', () => {
expect(parseCodexSpecialCommand(' /clear ')).toEqual({ type: 'clear' });
expect(parseCodexSpecialCommand('/compact')).toEqual({ type: 'compact' });
});
it('rejects argument-bearing special commands without treating them as prompts', () => {
expect(parseCodexSpecialCommand('/clear now')).toEqual({
type: 'invalid',
command: 'clear',
message: '/clear does not accept arguments'
});
expect(parseCodexSpecialCommand('/compact summarize this')).toEqual({
type: 'invalid',
command: 'compact',
message: '/compact does not accept arguments'
});
});
it('ignores regular slash-like messages', () => {
expect(parseCodexSpecialCommand('/clearing')).toEqual({ type: null });
expect(parseCodexSpecialCommand('please /clear')).toEqual({ type: null });
});
});