mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-28 19:52:02 +00:00
migrate compress command (#4271)
This commit is contained in:
parent
e88b9362dc
commit
b72e3dfb43
8 changed files with 230 additions and 96 deletions
|
|
@ -1204,38 +1204,4 @@ describe('useSlashCommandProcessor', () => {
|
|||
expect(commandResult).toEqual({ type: 'handled' });
|
||||
});
|
||||
});
|
||||
|
||||
describe('/compress command', () => {
|
||||
it('should call tryCompressChat(true)', async () => {
|
||||
const hook = getProcessorHook();
|
||||
mockTryCompressChat.mockResolvedValue({
|
||||
originalTokenCount: 100,
|
||||
newTokenCount: 50,
|
||||
});
|
||||
|
||||
await act(async () => {
|
||||
hook.result.current.handleSlashCommand('/compress');
|
||||
});
|
||||
await act(async () => {
|
||||
hook.rerender();
|
||||
});
|
||||
expect(hook.result.current.pendingHistoryItems).toEqual([]);
|
||||
expect(mockGeminiClient.tryCompressChat).toHaveBeenCalledWith(
|
||||
'Prompt Id not set',
|
||||
true,
|
||||
);
|
||||
expect(mockAddItem).toHaveBeenNthCalledWith(
|
||||
2,
|
||||
expect.objectContaining({
|
||||
type: MessageType.COMPRESSION,
|
||||
compression: {
|
||||
isPending: false,
|
||||
originalTokenCount: 100,
|
||||
newTokenCount: 50,
|
||||
},
|
||||
}),
|
||||
expect.any(Number),
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue