From 96087853961e4a46cc6ba05a873879f069e2f459 Mon Sep 17 00:00:00 2001 From: Aditya Rathore <153427299+AdityaDRathore@users.noreply.github.com> Date: Sat, 17 May 2025 20:05:06 +0000 Subject: [PATCH] fix: load environment variables in database connection test --- backend/src/tests/db-connection.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/src/tests/db-connection.test.ts b/backend/src/tests/db-connection.test.ts index 3f5bc7c..c494e4d 100644 --- a/backend/src/tests/db-connection.test.ts +++ b/backend/src/tests/db-connection.test.ts @@ -1,4 +1,8 @@ import { PrismaClient } from '@prisma/client'; +import * as dotenv from 'dotenv'; + +// Load environment variables +dotenv.config(); describe('Database Connection', () => { let prisma: PrismaClient; @@ -13,7 +17,7 @@ describe('Database Connection', () => { it('should connect to the database successfully', async () => { if (!process.env.DATABASE_URL) { - // Remove console.log and use return to skip test + console.warn('DATABASE_URL not found, skipping test'); return; }