mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-04 01:44:13 +00:00
test(server): src/config takes fixed test values from the setup file, so suites stop mocking it
tests/setup.ts mocks src/config once with tests/helpers/test-config.ts. A suite that needs other values calls overrideTestConfig(), and the setup file restores the defaults after every case. The 191 per-file factories are gone; config.test.ts takes the real module through vi.unmock, and the few suites that signed tokens with their own literal secret read it from TEST_CONFIG.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
import jwt from 'jsonwebtoken';
|
||||
import { TEST_CONFIG } from './test-db';
|
||||
import { TEST_CONFIG } from './test-config';
|
||||
|
||||
/** Signs a JWT for the given user ID using the test secret. */
|
||||
export function generateToken(userId: number, extraClaims: Record<string, unknown> = {}): string {
|
||||
|
||||
Reference in New Issue
Block a user