fix(sharing): widen the grant db slice for the expired-row sweep

The pre-create sweep in inviteGrant writes an audit row when it closes a
lapsed grant, so the transaction slice it accepts now covers auditLog
alongside accountGrant. Point the module and route test fakes at the
same shape: they stub updateMany to close nothing, so the audit branch
stays unreached in the unit fixtures.
This commit is contained in:
Marc-André Bombeck committed 2026-08-08 21:14:23 +02:00
1 parent ae2b82b1d9
commit e0692efba8
4 files changed
+21 -7

No files matched your search

@@ -38,7 +38,12 @@ vi.mock("@/lib/api-handler", async () => {
vi.mock("@/lib/db", () => ({
prisma: {
user: { findFirst: vi.fn() },
accountGrant: { create: vi.fn() },
accountGrant: {
create: vi.fn(),
// inviteGrant sweeps expired live-pair rows before the create; nothing to
// close in these fixtures.
updateMany: vi.fn().mockResolvedValue({ count: 0 }),
},
},
}));
@@ -43,7 +43,12 @@ vi.mock("@/lib/api-handler", async () => {
vi.mock("@/lib/db", () => ({
prisma: {
user: { findFirst: vi.fn() },
accountGrant: { create: vi.fn() },
accountGrant: {
create: vi.fn(),
// inviteGrant sweeps expired live-pair rows before the create. No such
// row exists in these unit fixtures, so it closes nothing.
updateMany: vi.fn().mockResolvedValue({ count: 0 }),
},
},
}));