fix: add missing _count to getRepositoryById test mock

The mock for repositories.findUnique was missing the _count field
that Prisma returns when using include: { _count: { select: ... } }.
This caused repo._count.repository_members to throw, which the catch
block swallowed and returned null, making all 3 "successful retrieval"
tests fail with "Cannot read properties of null (reading 'is_active')".

Add _count: { repository_members: 2 } to match the actual Prisma
return shape. All 39 tests now pass.
This commit is contained in:
Kevin Turcios 2026-04-11 03:58:34 -05:00
parent 7221d44858
commit 26307af804

View file

@ -28,6 +28,8 @@ const mockRepo = {
optimizations_limit: 100,
optimizations_used: 50,
repository_members: [{ id: "rm-1" }, { id: "rm-2" }],
// Matches the Prisma return shape for include: { _count: { select: { repository_members: true } } }
_count: { repository_members: 2 },
}
const mockPayload = { userId: "user-1", username: "testuser" }