summaryrefslogtreecommitdiff
path: root/packages/cli/src/config/config.integration.test.ts
diff options
context:
space:
mode:
authorTommaso Sciortino <[email protected]>2025-06-07 16:17:27 -0700
committerGitHub <[email protected]>2025-06-07 16:17:27 -0700
commit389907ce6537bd8caeb10b3d4dacaa8ece059500 (patch)
tree71c843ca52176dbc69e46f8df675f0b91fe2e16b /packages/cli/src/config/config.integration.test.ts
parente95a6086fc89191888f2a4e41a3c875273311d96 (diff)
Introduce ContentGeneratorConfig (#826)
Diffstat (limited to 'packages/cli/src/config/config.integration.test.ts')
-rw-r--r--packages/cli/src/config/config.integration.test.ts57
1 files changed, 29 insertions, 28 deletions
diff --git a/packages/cli/src/config/config.integration.test.ts b/packages/cli/src/config/config.integration.test.ts
index c016aa98..2cbe8c66 100644
--- a/packages/cli/src/config/config.integration.test.ts
+++ b/packages/cli/src/config/config.integration.test.ts
@@ -8,7 +8,17 @@ import { describe, it, expect, beforeEach, vi, afterEach } from 'vitest';
import * as fs from 'fs';
import * as path from 'path';
import { tmpdir } from 'os';
-import { Config, ConfigParameters } from '@gemini-cli/core';
+import {
+ Config,
+ ConfigParameters,
+ ContentGeneratorConfig,
+} from '@gemini-cli/core';
+
+const TEST_CONTENT_GENERATOR_CONFIG: ContentGeneratorConfig = {
+ apiKey: 'test-key',
+ model: 'test-model',
+ userAgent: 'test-agent',
+};
// Mock file discovery service and tool registry
vi.mock('@gemini-cli/core', async () => {
@@ -43,12 +53,11 @@ describe('Configuration Integration Tests', () => {
describe('File Filtering Configuration', () => {
it('should load default file filtering settings', async () => {
const configParams: ConfigParameters = {
- apiKey: 'test-key',
- model: 'test-model',
+ contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
+ embeddingModel: 'test-embedding-model',
sandbox: false,
targetDir: tempDir,
debugMode: false,
- userAgent: 'test-agent',
fileFilteringRespectGitIgnore: undefined, // Should default to true
fileFilteringAllowBuildArtifacts: undefined, // Should default to false
};
@@ -61,12 +70,11 @@ describe('Configuration Integration Tests', () => {
it('should load custom file filtering settings from configuration', async () => {
const configParams: ConfigParameters = {
- apiKey: 'test-key',
- model: 'test-model',
+ contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
+ embeddingModel: 'test-embedding-model',
sandbox: false,
targetDir: tempDir,
debugMode: false,
- userAgent: 'test-agent',
fileFilteringRespectGitIgnore: false,
fileFilteringAllowBuildArtifacts: true,
};
@@ -79,12 +87,11 @@ describe('Configuration Integration Tests', () => {
it('should merge user and workspace file filtering settings', async () => {
const configParams: ConfigParameters = {
- apiKey: 'test-key',
- model: 'test-model',
+ contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
+ embeddingModel: 'test-embedding-model',
sandbox: false,
targetDir: tempDir,
debugMode: false,
- userAgent: 'test-agent',
fileFilteringRespectGitIgnore: true,
fileFilteringAllowBuildArtifacts: true,
};
@@ -99,12 +106,11 @@ describe('Configuration Integration Tests', () => {
describe('Configuration Integration', () => {
it('should handle partial configuration objects gracefully', async () => {
const configParams: ConfigParameters = {
- apiKey: 'test-key',
- model: 'test-model',
+ contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
+ embeddingModel: 'test-embedding-model',
sandbox: false,
targetDir: tempDir,
debugMode: false,
- userAgent: 'test-agent',
fileFilteringRespectGitIgnore: false,
fileFilteringAllowBuildArtifacts: undefined, // Should default to false
};
@@ -120,12 +126,11 @@ describe('Configuration Integration Tests', () => {
it('should handle empty configuration objects gracefully', async () => {
const configParams: ConfigParameters = {
- apiKey: 'test-key',
- model: 'test-model',
+ contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
+ embeddingModel: 'test-embedding-model',
sandbox: false,
targetDir: tempDir,
debugMode: false,
- userAgent: 'test-agent',
fileFilteringRespectGitIgnore: undefined,
fileFilteringAllowBuildArtifacts: undefined,
};
@@ -139,12 +144,11 @@ describe('Configuration Integration Tests', () => {
it('should handle missing configuration sections gracefully', async () => {
const configParams: ConfigParameters = {
- apiKey: 'test-key',
- model: 'test-model',
+ contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
+ embeddingModel: 'test-embedding-model',
sandbox: false,
targetDir: tempDir,
debugMode: false,
- userAgent: 'test-agent',
// Missing fileFiltering configuration
};
@@ -159,12 +163,11 @@ describe('Configuration Integration Tests', () => {
describe('Real-world Configuration Scenarios', () => {
it('should handle a security-focused configuration', async () => {
const configParams: ConfigParameters = {
- apiKey: 'test-key',
- model: 'test-model',
+ contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
+ embeddingModel: 'test-embedding-model',
sandbox: false,
targetDir: tempDir,
debugMode: false,
- userAgent: 'test-agent',
fileFilteringRespectGitIgnore: true,
fileFilteringAllowBuildArtifacts: false,
};
@@ -177,12 +180,11 @@ describe('Configuration Integration Tests', () => {
it('should handle a development-focused configuration', async () => {
const configParams: ConfigParameters = {
- apiKey: 'test-key',
- model: 'test-model',
+ contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
+ embeddingModel: 'test-embedding-model',
sandbox: false,
targetDir: tempDir,
debugMode: false,
- userAgent: 'test-agent',
fileFilteringRespectGitIgnore: true,
fileFilteringAllowBuildArtifacts: true,
};
@@ -194,12 +196,11 @@ describe('Configuration Integration Tests', () => {
it('should handle a CI/CD environment configuration', async () => {
const configParams: ConfigParameters = {
- apiKey: 'test-key',
- model: 'test-model',
+ contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
+ embeddingModel: 'test-embedding-model',
sandbox: false,
targetDir: tempDir,
debugMode: false,
- userAgent: 'test-agent',
fileFilteringRespectGitIgnore: false, // CI might need to see all files
fileFilteringAllowBuildArtifacts: true,
};