/**
* Vitest Global Test Setup
* Runs before all test suites
*/
import { beforeAll, afterAll, vi } from 'vitest';
// Mock environment variables
beforeAll(() => {
process.env.KOMODO_URL = 'https://test.komodo.example.com';
process.env.KOMODO_API_KEY = 'test_api_key_12345';
process.env.KOMODO_API_SECRET = 'test_api_secret_67890';
process.env.KOMODO_TIMEOUT = '5000';
process.env.KOMODO_RETRY_COUNT = '2';
process.env.KOMODO_LOG_LEVEL = 'error';
});
// Clean up after all tests
afterAll(() => {
vi.clearAllMocks();
vi.restoreAllMocks();
});
// Global test utilities
global.createMockResponse = (data: any, status = 200) => ({
ok: status >= 200 && status < 300,
status,
statusText: status === 200 ? 'OK' : 'Error',
json: async () => data,
text: async () => JSON.stringify(data),
headers: new Headers({
'content-type': 'application/json',
}),
});
declare global {
var createMockResponse: (data: any, status?: number) => any;
}