Skip to content

Commit cbe150e

Browse files
committed
Mock the db server in the new tests
1 parent b41e964 commit cbe150e

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

apps/webapp/test/sessionDuration.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1+
import { describe, expect, it, vi } from "vitest";
2+
3+
// `~/db.server` eagerly calls $connect() on the singleton Prisma client at
4+
// module load. Without this mock the test process tries to reach DATABASE_URL
5+
// (defaults to localhost:5432) and emits an unhandled rejection that fails the
6+
// run. Tests still get a real Prisma client via the testcontainer fixture.
7+
vi.mock("~/db.server", () => ({
8+
prisma: {},
9+
$replica: {},
10+
}));
11+
112
import { containerTest } from "@internal/testcontainers";
213
import { createCookieSessionStorage, type Session } from "@remix-run/node";
3-
import { describe, expect, it, vi } from "vitest";
414

515
vi.setConfig({ testTimeout: 60_000 });
616
import {

0 commit comments

Comments
 (0)