feat(gateway): complete openclaw phase1 queue parity v2
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
|
||||
import { createElevateCommand, createModelCommand } from './index.js';
|
||||
import { createElevateCommand, createModelCommand, createQueueCommand } from './index.js';
|
||||
|
||||
describe('builtin /model command', () => {
|
||||
it('passes through the full argument string', async () => {
|
||||
@@ -67,3 +67,47 @@ describe('builtin /elevate command', () => {
|
||||
expect(result).toEqual({ handled: true, text: 'status' });
|
||||
});
|
||||
});
|
||||
|
||||
describe('builtin /queue command', () => {
|
||||
it('shows queue status with no args', async () => {
|
||||
const cmd = createQueueCommand();
|
||||
const getQueue = vi.fn(() => 'queue status');
|
||||
const result = await cmd.execute([], {
|
||||
channel: 'test',
|
||||
senderId: 'user',
|
||||
sessionId: 's1',
|
||||
rawInput: '/queue',
|
||||
services: { getQueue },
|
||||
});
|
||||
expect(getQueue).toHaveBeenCalledOnce();
|
||||
expect(result).toEqual({ handled: true, text: 'queue status' });
|
||||
});
|
||||
|
||||
it('passes through set operations', async () => {
|
||||
const cmd = createQueueCommand();
|
||||
const setQueue = vi.fn(() => 'updated');
|
||||
const result = await cmd.execute(['set', 'mode', 'followup'], {
|
||||
channel: 'test',
|
||||
senderId: 'user',
|
||||
sessionId: 's1',
|
||||
rawInput: '/queue set mode followup',
|
||||
services: { setQueue },
|
||||
});
|
||||
expect(setQueue).toHaveBeenCalledWith('mode followup');
|
||||
expect(result).toEqual({ handled: true, text: 'updated' });
|
||||
});
|
||||
|
||||
it('calls reset operation', async () => {
|
||||
const cmd = createQueueCommand();
|
||||
const resetQueue = vi.fn(() => 'reset');
|
||||
const result = await cmd.execute(['reset'], {
|
||||
channel: 'test',
|
||||
senderId: 'user',
|
||||
sessionId: 's1',
|
||||
rawInput: '/queue reset',
|
||||
services: { resetQueue },
|
||||
});
|
||||
expect(resetQueue).toHaveBeenCalledOnce();
|
||||
expect(result).toEqual({ handled: true, text: 'reset' });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user