-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjest.setup.js
More file actions
37 lines (31 loc) · 864 Bytes
/
jest.setup.js
File metadata and controls
37 lines (31 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Jest setup file
process.env.NODE_ENV = 'test';
// Mock environment variables for testing
process.env.API_KEY = 'test-anthropic-key';
process.env.OPENAI_API_KEY = 'test-openai-key';
// Mock console methods to reduce noise in tests
const originalConsoleError = console.error;
const originalConsoleWarn = console.warn;
beforeAll(() => {
console.error = jest.fn();
console.warn = jest.fn();
});
afterAll(() => {
console.error = originalConsoleError;
console.warn = originalConsoleWarn;
});
// Global test utilities
global.testUtils = {
mockProviderResponse: (data) => ({
choices: [{ message: { content: JSON.stringify(data) } }]
}),
mockFileSystem: () => {
jest.mock('fs-extra', () => ({
readFile: jest.fn(),
writeFile: jest.fn(),
existsSync: jest.fn(),
mkdirp: jest.fn(),
readdir: jest.fn()
}));
}
};