test: admin seed ve kimlik doğrulama entegrasyon testleri
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { loadEnv } from "vite";
|
||||
import { defineConfig } from "vitest/config";
|
||||
|
||||
/**
|
||||
* Entegrasyon testleri: gerçek MongoDB (npm run db:up) üzerinde, ayrı "butcem_test" veritabanı.
|
||||
* Çalıştırma: npm run test:integration
|
||||
*/
|
||||
const fileEnv = loadEnv("test", process.cwd(), "");
|
||||
const local = { ...loadEnv("development", process.cwd(), ""), ...fileEnv };
|
||||
const baseUri =
|
||||
process.env.MONGODB_URI_TEST ??
|
||||
(
|
||||
local.MONGODB_URI ?? "mongodb://localhost:27019/butcem?replicaSet=rs0&directConnection=true"
|
||||
).replace(/\/([^/?]+)(\?|$)/, "/butcem_test$2");
|
||||
|
||||
export default defineConfig({
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
||||
"server-only": fileURLToPath(new URL("./src/test/server-only-stub.ts", import.meta.url)),
|
||||
},
|
||||
},
|
||||
test: {
|
||||
environment: "node",
|
||||
include: ["src/**/*.int.test.ts"],
|
||||
fileParallelism: false,
|
||||
testTimeout: 20_000,
|
||||
hookTimeout: 30_000,
|
||||
env: {
|
||||
NODE_ENV: "test",
|
||||
MONGODB_URI: baseUri,
|
||||
BETTER_AUTH_SECRET: "test-secret-test-secret-test-secret-0123",
|
||||
BETTER_AUTH_URL: "http://localhost:3000",
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user