conductor/backend/src/lib/productionConfig.test.ts
Victor Wiebe ade2b10033
Some checks failed
Release production image / production-image (push) Has been cancelled
Add production packaging and operations
2026-08-07 16:48:40 -04:00

18 lines
872 B
TypeScript

import assert from 'node:assert/strict';
import test from 'node:test';
import { validateProductionConfiguration } from './productionConfig';
test('development does not require production keys', () => {
assert.doesNotThrow(() => validateProductionConfiguration({ NODE_ENV: 'development' }));
});
test('production requires both correctly sized persistent keys', () => {
assert.throws(() => validateProductionConfiguration({ NODE_ENV: 'production' }), /CONDUCTOR_SECRET_KEY/);
assert.throws(() => validateProductionConfiguration({ NODE_ENV: 'production', CONDUCTOR_SECRET_KEY: '11'.repeat(32) }), /CONDUCTOR_SESSION_KEY/);
assert.doesNotThrow(() => validateProductionConfiguration({
NODE_ENV: 'production',
CONDUCTOR_SECRET_KEY: Buffer.alloc(32, 7).toString('base64'),
CONDUCTOR_SESSION_KEY: 'session-key-material-that-is-at-least-32-bytes',
}));
});