fix tests

This commit is contained in:
bkellam 2025-10-18 14:03:05 -07:00
parent 99c51dd236
commit 3f72a533c6
3 changed files with 5 additions and 6 deletions

View file

@ -4,5 +4,8 @@ export default defineConfig({
test: { test: {
environment: 'node', environment: 'node',
watch: false, watch: false,
env: {
DATA_CACHE_DIR: 'test-data'
}
} }
}); });

View file

@ -58,7 +58,3 @@ export const userScopedPrismaClientExtension = (userId?: string) => {
}) })
}) })
} }
export const getPrismaClient = (userId?: string) => {
return prisma.$extends(userScopedPrismaClientExtension(userId)) as PrismaClient;
}

View file

@ -1,4 +1,4 @@
import { getPrismaClient, prisma as __unsafePrisma } from "@/prisma"; import { prisma as __unsafePrisma, userScopedPrismaClientExtension } from "@/prisma";
import { hashSecret } from "@sourcebot/crypto"; import { hashSecret } from "@sourcebot/crypto";
import { ApiKey, Org, OrgRole, PrismaClient, User } from "@sourcebot/db"; import { ApiKey, Org, OrgRole, PrismaClient, User } from "@sourcebot/db";
import { headers } from "next/headers"; import { headers } from "next/headers";
@ -88,7 +88,7 @@ export const getAuthContext = async (): Promise<OptionalAuthContext | ServiceErr
}, },
}) : null; }) : null;
const prisma = getPrismaClient(user?.id); const prisma = __unsafePrisma.$extends(userScopedPrismaClientExtension(user?.id)) as PrismaClient;
return { return {
user: user ?? undefined, user: user ?? undefined,