mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 21:32:56 -07:00
@@ -42,6 +42,7 @@ describe('compressCommand', () => {
|
||||
},
|
||||
};
|
||||
await compressCommand.action!(context, '');
|
||||
await new Promise((r) => setTimeout(r, 0));
|
||||
expect(context.ui.addItem).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
type: MessageType.ERROR,
|
||||
@@ -62,6 +63,7 @@ describe('compressCommand', () => {
|
||||
mockTryCompressChat.mockResolvedValue(compressedResult);
|
||||
|
||||
await compressCommand.action!(context, '');
|
||||
await new Promise((r) => setTimeout(r, 0));
|
||||
|
||||
expect(context.ui.setPendingItem).toHaveBeenNthCalledWith(1, {
|
||||
type: MessageType.COMPRESSION,
|
||||
@@ -98,6 +100,7 @@ describe('compressCommand', () => {
|
||||
mockTryCompressChat.mockResolvedValue(null);
|
||||
|
||||
await compressCommand.action!(context, '');
|
||||
await new Promise((r) => setTimeout(r, 0));
|
||||
|
||||
expect(context.ui.addItem).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
@@ -114,6 +117,7 @@ describe('compressCommand', () => {
|
||||
mockTryCompressChat.mockRejectedValue(error);
|
||||
|
||||
await compressCommand.action!(context, '');
|
||||
await new Promise((r) => setTimeout(r, 0));
|
||||
|
||||
expect(context.ui.addItem).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
@@ -128,6 +132,7 @@ describe('compressCommand', () => {
|
||||
it('should clear the pending item in a finally block', async () => {
|
||||
mockTryCompressChat.mockRejectedValue(new Error('some error'));
|
||||
await compressCommand.action!(context, '');
|
||||
await new Promise((r) => setTimeout(r, 0));
|
||||
expect(context.ui.setPendingItem).toHaveBeenCalledWith(null);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user