forked from Disciplr-Org/Disciplr-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setup.cjs
More file actions
12 lines (11 loc) · 791 Bytes
/
Copy pathjest.setup.cjs
File metadata and controls
12 lines (11 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
// Global Jest setup: runs before each test file, before the test framework is
// installed. Used to seed environment defaults required by modules under test.
// Field encryption requires a key to be configured. Provide a deterministic,
// non-secret 32-byte (base64) key for the test environment so repositories that
// encrypt/decrypt reversible secrets work without each suite wiring its own key.
// Individual suites may override FIELD_ENCRYPTION_KEY / FIELD_ENCRYPTION_KEYS
// (e.g. to test rotation) and reset the cached env via _resetEnvForTesting().
if (!process.env.FIELD_ENCRYPTION_KEY && !process.env.FIELD_ENCRYPTION_KEYS) {
// 32 zero bytes, base64-encoded — test-only, never use in production.
process.env.FIELD_ENCRYPTION_KEY = Buffer.alloc(32, 0).toString('base64')
}