mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-09 03:03:24 +08:00
feat: add session and preset list aliases
This commit is contained in:
parent
92ec91b7bd
commit
98c1e48271
21 changed files with 112 additions and 58 deletions
|
|
@ -46,20 +46,35 @@ function fixture({
|
|||
return { calls, harness, state: {}, selected: () => selected };
|
||||
}
|
||||
|
||||
test('isPresetCommand recognizes only /presetlist and /preset command prefixes', () => {
|
||||
test('isPresetCommand recognizes /presets, /presetlist, and /preset command prefixes', () => {
|
||||
for (const command of [
|
||||
'/presetlist', ' /PRESETLIST ', '/presetlist ignored',
|
||||
'/presetlist', ' /PRESETLIST ', '/presetlist ignored', '/presets', ' /PRESETS ',
|
||||
'/preset', '/PrEsEt coding',
|
||||
]) {
|
||||
assert.equal(isPresetCommand(command), true, command);
|
||||
}
|
||||
for (const value of [
|
||||
null, '', 'preset', '/presetx', '/presetlisting', 'hello /preset',
|
||||
null, '', 'preset', '/presetx', '/presetlisting', '/presetss', 'hello /preset',
|
||||
]) {
|
||||
assert.equal(isPresetCommand(value), false, String(value));
|
||||
}
|
||||
});
|
||||
|
||||
test('/presets reuses /presetlist validation, listing, and snapshot behavior', async () => {
|
||||
const { calls, harness, state } = fixture({ agentPreset: 'coding' });
|
||||
const listed = await runPresetCommand(' /PRESETS ', harness, state, 'direct:alias');
|
||||
|
||||
assert.match(listed.message, /2\. Coding(coding)(当前选择)/);
|
||||
assert.deepEqual(calls, [['agentPresetSettings', {}]]);
|
||||
|
||||
const selected = await runPresetCommand('/preset 1', harness, state, 'direct:alias');
|
||||
assert.match(selected.message, /Standard(standard)/);
|
||||
assert.deepEqual(calls.at(-1), ['updateAgentPreset', 'standard', {}]);
|
||||
|
||||
const invalid = await runPresetCommand('/presets unexpected', harness, state, 'direct:alias');
|
||||
assert.match(invalid.message, /用法:\/presetlist/);
|
||||
});
|
||||
|
||||
test('/presetlist dynamically lists, annotates, and snapshots presets without updating', async () => {
|
||||
const { calls, harness, state } = fixture({ agentPreset: 'coding' });
|
||||
const signal = new AbortController().signal;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue