mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 14:10:37 -07:00
Make test suite pass when the GEMINI_SYSTEM_MD env variable or GEMINI_WRITE_SYSTEM_MD variable happens to be set locally/ (#21480)
This commit is contained in:
@@ -4,13 +4,22 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||
import { GeneralistAgent } from './generalist-agent.js';
|
||||
import { makeFakeConfig } from '../test-utils/config.js';
|
||||
import type { ToolRegistry } from '../tools/tool-registry.js';
|
||||
import type { AgentRegistry } from './registry.js';
|
||||
|
||||
describe('GeneralistAgent', () => {
|
||||
beforeEach(() => {
|
||||
vi.stubEnv('GEMINI_SYSTEM_MD', '');
|
||||
vi.stubEnv('GEMINI_WRITE_SYSTEM_MD', '');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.unstubAllEnvs();
|
||||
});
|
||||
|
||||
it('should create a valid generalist agent definition', () => {
|
||||
const config = makeFakeConfig();
|
||||
vi.spyOn(config, 'getToolRegistry').mockReturnValue({
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||
import { PromptProvider } from './promptProvider.js';
|
||||
import type { Config } from '../config/config.js';
|
||||
import {
|
||||
@@ -35,6 +35,9 @@ describe('PromptProvider', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
vi.resetAllMocks();
|
||||
vi.stubEnv('GEMINI_SYSTEM_MD', '');
|
||||
vi.stubEnv('GEMINI_WRITE_SYSTEM_MD', '');
|
||||
|
||||
mockConfig = {
|
||||
getToolRegistry: vi.fn().mockReturnValue({
|
||||
getAllToolNames: vi.fn().mockReturnValue([]),
|
||||
@@ -60,6 +63,10 @@ describe('PromptProvider', () => {
|
||||
} as unknown as Config;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.unstubAllEnvs();
|
||||
});
|
||||
|
||||
it('should handle multiple context filenames in the system prompt', () => {
|
||||
vi.mocked(getAllGeminiMdFilenames).mockReturnValue([
|
||||
DEFAULT_CONTEXT_FILENAME,
|
||||
|
||||
Reference in New Issue
Block a user