diff --git a/bunfig.toml b/bunfig.toml new file mode 100644 index 0000000..8370a01 --- /dev/null +++ b/bunfig.toml @@ -0,0 +1,2 @@ +[test] +preload = ["./tests/setup.ts"] diff --git a/tests/integration/api.test.ts b/tests/integration/api.test.ts index 07af84e..6313d4a 100644 --- a/tests/integration/api.test.ts +++ b/tests/integration/api.test.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(() => { diff --git a/tests/setup.ts b/tests/setup.ts new file mode 100644 index 0000000..1d0a6f2 --- /dev/null +++ b/tests/setup.ts @@ -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";