mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-31 06:42:03 +00:00
test: enhance agent-service tests with context loading mock
- Added a mock for the `loadContextFiles` function to return an empty context by default, improving test reliability. - Updated the agent-service test suite to ensure proper initialization of the `AgentService` with mocked dependencies. These changes aim to enhance the test coverage and stability of the agent-service functionality.
This commit is contained in:
@@ -4,12 +4,12 @@ import { ProviderFactory } from '@/providers/provider-factory.js';
|
||||
import * as fs from 'fs/promises';
|
||||
import * as imageHandler from '@automaker/utils';
|
||||
import * as promptBuilder from '@automaker/utils';
|
||||
import * as contextLoader from '@automaker/utils';
|
||||
import { collectAsyncGenerator } from '../../utils/helpers.js';
|
||||
|
||||
vi.mock('fs/promises');
|
||||
vi.mock('@/providers/provider-factory.js');
|
||||
vi.mock('@automaker/utils');
|
||||
vi.mock('@automaker/utils');
|
||||
|
||||
describe('agent-service.ts', () => {
|
||||
let service: AgentService;
|
||||
@@ -21,6 +21,12 @@ describe('agent-service.ts', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
service = new AgentService('/test/data', mockEvents as any);
|
||||
|
||||
// Mock loadContextFiles to return empty context by default
|
||||
vi.mocked(contextLoader.loadContextFiles).mockResolvedValue({
|
||||
files: [],
|
||||
formattedPrompt: '',
|
||||
});
|
||||
});
|
||||
|
||||
describe('initialize', () => {
|
||||
|
||||
Reference in New Issue
Block a user