Refactor test database setup and add migrations
- Updated test files to use a separate test database configuration. - Introduced a new helper module for managing test database operations. - Added a setup file to configure the environment for tests. - Created new database migration scripts to optimize message indexing. - Added a sample environment file for test database configuration.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import process from "node:process";
|
||||
import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
|
||||
import { assertSafeTestDatabaseUrl } from "./helpers/testDatabase";
|
||||
|
||||
const originalEnv = process.env;
|
||||
|
||||
@@ -14,6 +15,10 @@ describe("Drizzle ORM Database", () => {
|
||||
DISCORD_TOKEN: "test-token",
|
||||
NODE_ENV: "test",
|
||||
};
|
||||
if (originalEnv.TEST_DATABASE_URL) {
|
||||
process.env.DATABASE_URL = originalEnv.TEST_DATABASE_URL;
|
||||
}
|
||||
assertSafeTestDatabaseUrl();
|
||||
|
||||
// Reset modules to pick up new environment
|
||||
vi.resetModules();
|
||||
|
||||
Reference in New Issue
Block a user