Download packages/cli/src/utils/events.test.ts from SaylorTwift/gemini-cli: direct link, hf CLI and curl.
- Browser
- Download file 787 Bytes
-
https://huggingface.co/SaylorTwift/gemini-cli/resolve/main/packages/cli/src/utils/events.test.ts
- Command line
-
hf download hf://SaylorTwift/gemini-cli/packages/cli/src/utils/events.test.ts
-
curl -L -o events.test.ts https://huggingface.co/SaylorTwift/gemini-cli/resolve/main/packages/cli/src/utils/events.test.ts
787 Bytes
| /** | |
| * @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.SelectionWarning, callback); | |
| appEvents.emit(AppEvent.SelectionWarning); | |
| expect(callback).toHaveBeenCalled(); | |
| appEvents.off(AppEvent.SelectionWarning, 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); | |
| }); | |
| }); | |