mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-05 09:33:07 +00:00
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:
@@ -41,13 +41,14 @@ describe('model-resolver.ts', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should treat unknown models as falling back to default', () => {
|
it('should pass through unknown models unchanged (may be provider models)', () => {
|
||||||
// Note: Don't include valid Cursor model IDs here (e.g., 'gpt-5.2' is in CURSOR_MODEL_MAP)
|
// Unknown models now pass through unchanged to support ClaudeCompatibleProvider models
|
||||||
const models = ['o1', 'o1-mini', 'o3', 'unknown-model', 'fake-model-123'];
|
// 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) => {
|
models.forEach((model) => {
|
||||||
const result = resolveModelString(model);
|
const result = resolveModelString(model);
|
||||||
// Should fall back to default since these aren't supported
|
// Should pass through unchanged (could be provider models)
|
||||||
expect(result).toBe(DEFAULT_MODELS.claude);
|
expect(result).toBe(model);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -73,12 +74,12 @@ describe('model-resolver.ts', () => {
|
|||||||
expect(result).toBe(customDefault);
|
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');
|
const result = resolveModelString('unknown-model');
|
||||||
expect(result).toBe(DEFAULT_MODELS.claude);
|
// Unknown models pass through unchanged (could be provider models)
|
||||||
expect(consoleSpy.warn).toHaveBeenCalledWith(
|
expect(result).toBe('unknown-model');
|
||||||
expect.stringContaining('Unknown model key "unknown-model"')
|
// No warning - unknown models are valid for providers
|
||||||
);
|
expect(consoleSpy.warn).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle empty string', () => {
|
it('should handle empty string', () => {
|
||||||
|
|||||||
@@ -63,7 +63,10 @@ describe('IdeationService', () => {
|
|||||||
} as unknown as EventEmitter;
|
} as unknown as EventEmitter;
|
||||||
|
|
||||||
// Create mock settings service
|
// Create mock settings service
|
||||||
mockSettingsService = {} as SettingsService;
|
mockSettingsService = {
|
||||||
|
getCredentials: vi.fn().mockResolvedValue({}),
|
||||||
|
getGlobalSettings: vi.fn().mockResolvedValue({}),
|
||||||
|
} as unknown as SettingsService;
|
||||||
|
|
||||||
// Create mock feature loader
|
// Create mock feature loader
|
||||||
mockFeatureLoader = {
|
mockFeatureLoader = {
|
||||||
|
|||||||
Reference in New Issue
Block a user