forked from Streampay-Org/StreamPay-Frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setup.ts
More file actions
27 lines (23 loc) · 1.28 KB
/
jest.setup.ts
File metadata and controls
27 lines (23 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/// <reference types="node" />
import "@testing-library/jest-dom";
// =============================================================================
// Test Environment Configuration
// =============================================================================
// SECURITY: Tests run in testnet mode only to prevent accidental mainnet usage
// These values are safe for testing - they match the dev secrets documented
// in .env.example and are NOT production credentials
// =============================================================================
// Set required environment variables for testing
(process.env as any).STELLAR_NETWORK = process.env.STELLAR_NETWORK || "testnet";
(process.env as any).JWT_SECRET = process.env.JWT_SECRET || "streampay-dev-secret-do-not-use-in-prod";
(process.env as any).NODE_ENV = process.env.NODE_ENV || "test";
(process.env as any).SERVICE_NAME = process.env.SERVICE_NAME || "streampay-frontend-test";
// Security validation for test environment
if (process.env.STELLAR_NETWORK !== "testnet") {
throw new Error(
"SECURITY: Tests must run on testnet only. " +
`STELLAR_NETWORK was set to: ${process.env.STELLAR_NETWORK}`
);
}
// Reset config cache before each test to ensure clean state
// This is handled in individual test files via resetConfigCache()