test: fix server tests for provider model passthrough behavior

- Update model-resolver.test.ts to expect unknown models to pass through
  unchanged (supports ClaudeCompatibleProvider models like GLM-4.7)
- Remove warning expectations for unknown models (valid for providers)
- Add missing getCredentials and getGlobalSettings mocks to
  ideation-service.test.ts for settingsService
This commit is contained in:
Stefan de Vogelaere
2026-01-20 20:23:29 +01:00
parent f007ca2c80
commit e3f3f5fbd1
2 changed files with 15 additions and 11 deletions

View File

@@ -41,13 +41,14 @@ describe('model-resolver.ts', () => {
);
});
it('should treat unknown models as falling back to default', () => {
// Note: Don't include valid Cursor model IDs here (e.g., 'gpt-5.2' is in CURSOR_MODEL_MAP)
const models = ['o1', 'o1-mini', 'o3', 'unknown-model', 'fake-model-123'];
it('should pass through unknown models unchanged (may be provider models)', () => {
// Unknown models now pass through unchanged to support ClaudeCompatibleProvider models
// like GLM-4.7, MiniMax-M2.1, o1, etc.
const models = ['o1', 'o1-mini', 'o3', 'unknown-model', 'fake-model-123', 'GLM-4.7'];
models.forEach((model) => {
const result = resolveModelString(model);
// Should fall back to default since these aren't supported
expect(result).toBe(DEFAULT_MODELS.claude);
// Should pass through unchanged (could be provider models)
expect(result).toBe(model);
});
});
@@ -73,12 +74,12 @@ describe('model-resolver.ts', () => {
expect(result).toBe(customDefault);
});
it('should return default for unknown model key', () => {
it('should pass through unknown model key unchanged (no warning)', () => {
const result = resolveModelString('unknown-model');
expect(result).toBe(DEFAULT_MODELS.claude);
expect(consoleSpy.warn).toHaveBeenCalledWith(
expect.stringContaining('Unknown model key "unknown-model"')
);
// Unknown models pass through unchanged (could be provider models)
expect(result).toBe('unknown-model');
// No warning - unknown models are valid for providers
expect(consoleSpy.warn).not.toHaveBeenCalled();
});
it('should handle empty string', () => {

View File

@@ -63,7 +63,10 @@ describe('IdeationService', () => {
} as unknown as EventEmitter;
// Create mock settings service
mockSettingsService = {} as SettingsService;
mockSettingsService = {
getCredentials: vi.fn().mockResolvedValue({}),
getGlobalSettings: vi.fn().mockResolvedValue({}),
} as unknown as SettingsService;
// Create mock feature loader
mockFeatureLoader = {