feat: prepare six-lesson trial backend with reliable rewards and operations
Backend CI / type-check, build, tests (push) Successful in 1m0s
Backend CI / type-check, build, tests (push) Successful in 1m0s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
import 'reflect-metadata'
|
||||
import assert from 'node:assert/strict'
|
||||
import { validateEnv } from '../src/config/env.validation'
|
||||
|
||||
const VALID_PROD_SECRET = 'a'.repeat(48)
|
||||
|
||||
assert.throws(
|
||||
() =>
|
||||
validateEnv({
|
||||
NODE_ENV: 'production',
|
||||
PORT: 3000,
|
||||
HOST: '0.0.0.0',
|
||||
CORS_ORIGIN: 'https://app.example.com',
|
||||
JWT_SECRET: '',
|
||||
}),
|
||||
/JWT_SECRET is required/,
|
||||
)
|
||||
|
||||
assert.throws(
|
||||
() =>
|
||||
validateEnv({
|
||||
NODE_ENV: 'production',
|
||||
PORT: 3000,
|
||||
HOST: '0.0.0.0',
|
||||
CORS_ORIGIN: 'https://app.example.com',
|
||||
JWT_SECRET: 'gold-land-dev-secret-change-in-production',
|
||||
}),
|
||||
/placeholder/,
|
||||
)
|
||||
|
||||
assert.throws(
|
||||
() =>
|
||||
validateEnv({
|
||||
NODE_ENV: 'production',
|
||||
PORT: 3000,
|
||||
HOST: '0.0.0.0',
|
||||
CORS_ORIGIN: 'https://app.example.com',
|
||||
JWT_SECRET: 'short',
|
||||
}),
|
||||
/32 characters/,
|
||||
)
|
||||
|
||||
assert.throws(
|
||||
() =>
|
||||
validateEnv({
|
||||
NODE_ENV: 'production',
|
||||
PORT: 3000,
|
||||
HOST: '0.0.0.0',
|
||||
CORS_ORIGIN: 'https://app.example.com',
|
||||
JWT_SECRET: VALID_PROD_SECRET,
|
||||
TRUST_PROXY: 'true',
|
||||
}),
|
||||
/TRUST_PROXY_CIDRS is required/,
|
||||
)
|
||||
|
||||
const ok = validateEnv({
|
||||
NODE_ENV: 'production',
|
||||
PORT: 3000,
|
||||
HOST: '0.0.0.0',
|
||||
CORS_ORIGIN: 'https://app.example.com',
|
||||
JWT_SECRET: VALID_PROD_SECRET,
|
||||
TRUST_PROXY: 'true',
|
||||
TRUST_PROXY_CIDRS: '172.20.0.0/16',
|
||||
})
|
||||
assert.equal(ok.NODE_ENV, 'production')
|
||||
|
||||
console.log('production-config tests passed')
|
||||
Reference in New Issue
Block a user