il2cpp-dump-analyzer-mcp
Version:
Agentic RAG system for analyzing IL2CPP dump.cs files from Unity games
96 lines • 3.25 kB
JavaScript
;
/**
* Jest test setup file
* Configures global test environment, mocks, and utilities
*/
Object.defineProperty(exports, "__esModule", { value: true });
const globals_1 = require("@jest/globals");
// Set test environment variables
process.env.NODE_ENV = 'test';
process.env.LOG_LEVEL = 'error'; // Reduce noise in tests
process.env.SUPABASE_URL = 'https://test.supabase.co';
process.env.SUPABASE_KEY = 'test-key';
process.env.DUMP_FILE_PATH = './test-dump.cs';
process.env.EMBEDDING_MODEL = 'Xenova/all-MiniLM-L6-v2';
// Mock console methods to reduce test output noise
const originalConsole = { ...console };
beforeAll(() => {
// Mock console methods but keep error for debugging
console.log = globals_1.jest.fn();
console.info = globals_1.jest.fn();
console.warn = globals_1.jest.fn();
console.debug = globals_1.jest.fn();
});
afterAll(() => {
// Restore console methods
Object.assign(console, originalConsole);
});
// Global test timeout
globals_1.jest.setTimeout(30000);
// Mock external dependencies that are not available in test environment
globals_1.jest.mock('@xenova/transformers', () => ({
pipeline: globals_1.jest.fn(() => Promise.resolve({
encode: globals_1.jest.fn(() => Promise.resolve([0.1, 0.2, 0.3, 0.4]))
})),
env: {
allowLocalModels: true,
allowRemoteModels: false
}
}));
globals_1.jest.mock('@supabase/supabase-js', () => ({
createClient: globals_1.jest.fn().mockReturnValue({
from: globals_1.jest.fn().mockReturnValue({
select: globals_1.jest.fn().mockReturnValue({
data: [],
error: null
}),
insert: globals_1.jest.fn().mockReturnValue({
data: [],
error: null
}),
upsert: globals_1.jest.fn().mockReturnValue({
data: [],
error: null
}),
delete: globals_1.jest.fn().mockReturnValue({
data: [],
error: null
})
}),
rpc: globals_1.jest.fn(() => Promise.resolve({
data: [],
error: null
}))
})
}));
// Mock file system operations - but allow actual file reading for tests
const actualFs = globals_1.jest.requireActual('fs');
globals_1.jest.mock('fs', () => ({
...actualFs,
writeFileSync: globals_1.jest.fn(),
promises: {
readFile: globals_1.jest.fn(),
writeFile: globals_1.jest.fn(),
access: globals_1.jest.fn()
}
}));
// Global test utilities
global.testUtils = {
createMockDocument: (metadata = {}) => ({
pageContent: 'test content',
metadata: {
name: 'TestClass',
type: 'class',
namespace: 'Test.Namespace',
fullName: 'Test.Namespace.TestClass',
...metadata
}
}),
createMockVectorStore: () => ({
similaritySearch: globals_1.jest.fn(() => Promise.resolve([])),
searchWithFilter: globals_1.jest.fn(() => Promise.resolve([])),
addDocuments: globals_1.jest.fn(() => Promise.resolve(undefined))
}),
delay: (ms) => new Promise(resolve => setTimeout(resolve, ms))
};
//# sourceMappingURL=setup.js.map