| 1234567891011121314151617181920212223242526 |
- /**
- * Test setup: uses an in-memory SQLite database and a fixed JWT secret.
- * All test files require this module first via mocha --require.
- */
- // Override the config module before anything else loads it
- const Module = require('module');
- const originalLoad = Module._load;
- const testConfig = {
- port: 3099,
- database: { type: 'sqlite', storage: ':memory:' },
- jwt: { secret: 'test-secret', expiresIn: '1h' },
- upload: { maxFileSizeMB: 10, tempDir: './temp' },
- cors: { origin: '*' },
- };
- Module._load = function (request, parent, isMain) {
- if (request === '../config' || request === '../../config') {
- return testConfig;
- }
- return originalLoad.apply(this, arguments);
- };
- // Also expose the config globally for test files
- global.testConfig = testConfig;
|