chore: centralize test environment configuration via bunfig and setup file
CI / build (pull_request) Successful in 21s
CI / build (pull_request) Successful in 21s
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
[test]
|
||||
preload = ["./tests/setup.ts"]
|
||||
@@ -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(() => {
|
||||
|
||||
@@ -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";
|
||||
Reference in New Issue
Block a user