test: dockerized test suite (openldap + redis + test-runner)
docker-compose.test.yml spins up the all-in-one OpenLDAP image, a standalone Redis, and a test-runner that seeds the test user and runs jest against them. globalSetup honors REDIS_URL; tests/setup.js initializes the ORM and flushes test Redis keys before the run. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,19 @@
|
||||
const crypto = require('crypto');
|
||||
const request = require('supertest');
|
||||
const app = require('../app');
|
||||
const { initORM } = require('../models');
|
||||
|
||||
beforeAll(async () => {
|
||||
await initORM();
|
||||
const { Token } = require('../models/token');
|
||||
try {
|
||||
if (Token.orm) {
|
||||
await Token.orm.adapter(Token).Table.redisClient.flushDb();
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('Could not flush Redis:', e.message);
|
||||
}
|
||||
});
|
||||
|
||||
const TEST_CREDS = { uid: 'test', password: 'MyTestPassword!2' };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user