mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 10:34:35 -07:00
Improve code coverage for cli package (#13724)
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2025 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { appEvents, AppEvent } from './events.js';
|
||||
|
||||
describe('events', () => {
|
||||
it('should allow registering and emitting events', () => {
|
||||
const callback = vi.fn();
|
||||
appEvents.on(AppEvent.OauthDisplayMessage, callback);
|
||||
|
||||
appEvents.emit(AppEvent.OauthDisplayMessage, 'test message');
|
||||
|
||||
expect(callback).toHaveBeenCalledWith('test message');
|
||||
|
||||
appEvents.off(AppEvent.OauthDisplayMessage, callback);
|
||||
});
|
||||
|
||||
it('should work with events without data', () => {
|
||||
const callback = vi.fn();
|
||||
appEvents.on(AppEvent.Flicker, callback);
|
||||
|
||||
appEvents.emit(AppEvent.Flicker);
|
||||
|
||||
expect(callback).toHaveBeenCalled();
|
||||
|
||||
appEvents.off(AppEvent.Flicker, callback);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user