mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
updated /stats to use new slash command arch (#4146)
This commit is contained in:
@@ -12,6 +12,7 @@ import { helpCommand } from '../ui/commands/helpCommand.js';
|
||||
import { clearCommand } from '../ui/commands/clearCommand.js';
|
||||
import { authCommand } from '../ui/commands/authCommand.js';
|
||||
import { themeCommand } from '../ui/commands/themeCommand.js';
|
||||
import { statsCommand } from '../ui/commands/statsCommand.js';
|
||||
import { privacyCommand } from '../ui/commands/privacyCommand.js';
|
||||
import { aboutCommand } from '../ui/commands/aboutCommand.js';
|
||||
|
||||
@@ -34,6 +35,9 @@ vi.mock('../ui/commands/themeCommand.js', () => ({
|
||||
vi.mock('../ui/commands/privacyCommand.js', () => ({
|
||||
privacyCommand: { name: 'privacy', description: 'Mock Privacy' },
|
||||
}));
|
||||
vi.mock('../ui/commands/statsCommand.js', () => ({
|
||||
statsCommand: { name: 'stats', description: 'Mock Stats' },
|
||||
}));
|
||||
vi.mock('../ui/commands/aboutCommand.js', () => ({
|
||||
aboutCommand: { name: 'about', description: 'Mock About' },
|
||||
}));
|
||||
@@ -62,7 +66,7 @@ describe('CommandService', () => {
|
||||
const tree = commandService.getCommands();
|
||||
|
||||
// Post-condition assertions
|
||||
expect(tree.length).toBe(7);
|
||||
expect(tree.length).toBe(8);
|
||||
|
||||
const commandNames = tree.map((cmd) => cmd.name);
|
||||
expect(commandNames).toContain('auth');
|
||||
@@ -70,6 +74,7 @@ describe('CommandService', () => {
|
||||
expect(commandNames).toContain('help');
|
||||
expect(commandNames).toContain('clear');
|
||||
expect(commandNames).toContain('theme');
|
||||
expect(commandNames).toContain('stats');
|
||||
expect(commandNames).toContain('privacy');
|
||||
expect(commandNames).toContain('about');
|
||||
});
|
||||
@@ -77,14 +82,14 @@ describe('CommandService', () => {
|
||||
it('should overwrite any existing commands when called again', async () => {
|
||||
// Load once
|
||||
await commandService.loadCommands();
|
||||
expect(commandService.getCommands().length).toBe(7);
|
||||
expect(commandService.getCommands().length).toBe(8);
|
||||
|
||||
// Load again
|
||||
await commandService.loadCommands();
|
||||
const tree = commandService.getCommands();
|
||||
|
||||
// Should not append, but overwrite
|
||||
expect(tree.length).toBe(7);
|
||||
expect(tree.length).toBe(8);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -96,7 +101,7 @@ describe('CommandService', () => {
|
||||
await commandService.loadCommands();
|
||||
|
||||
const loadedTree = commandService.getCommands();
|
||||
expect(loadedTree.length).toBe(7);
|
||||
expect(loadedTree.length).toBe(8);
|
||||
expect(loadedTree).toEqual([
|
||||
aboutCommand,
|
||||
authCommand,
|
||||
@@ -104,6 +109,7 @@ describe('CommandService', () => {
|
||||
helpCommand,
|
||||
memoryCommand,
|
||||
privacyCommand,
|
||||
statsCommand,
|
||||
themeCommand,
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user