chore: centralize test environment configuration via bunfig and setup file
CI / build (pull_request) Successful in 21s

This commit is contained in:
ramvignesh-b
2026-05-11 17:07:23 +05:30
parent 78520b9069
commit e6354aae00
3 changed files with 8 additions and 9 deletions
+2
View File
@@ -0,0 +1,2 @@
[test]
preload = ["./tests/setup.ts"]
+2 -9
View File
@@ -1,7 +1,5 @@
// @ts-nocheck
import { afterEach, describe, expect, it, mock } from "bun:test";
import { redis } from "../../src/core/RedisClient";
import { app } from "../../src/index";
mock.module("../../src/core/RedisClient", () => ({
redis: {
@@ -11,13 +9,8 @@ mock.module("../../src/core/RedisClient", () => ({
},
}));
mock.module("../../src/config", () => ({
config: {
API_KEY: "test-api-key",
PORT: "3000",
REDIS_URL: "redis://localhost:6379",
},
}));
import { redis } from "../../src/core/RedisClient";
import { app } from "../../src/index";
describe("API Integration", () => {
afterEach(() => {
+4
View File
@@ -0,0 +1,4 @@
// Global test setup to stub environment variables
process.env.API_KEY = "test-api-key";
process.env.REDIS_URL = "redis://localhost:6379";
process.env.PORT = "3000";