diff --git a/tests/unit/getAdminUser.test.ts b/tests/unit/getAdminUser.test.ts index 53c820b..dceb399 100644 --- a/tests/unit/getAdminUser.test.ts +++ b/tests/unit/getAdminUser.test.ts @@ -97,12 +97,12 @@ describe("getAdminUser()", () => { }), }) // Second select: adminUserBrands — returns empty + // The real code awaits `.from().innerJoin().where()` directly (no .limit()), + // so the mock makes `.where()` itself the thenable. .mockReturnValueOnce({ from: () => ({ innerJoin: () => ({ - where: () => ({ - limit: async () => [], - }), + where: async () => [], }), }), }); @@ -127,19 +127,18 @@ describe("getAdminUser()", () => { }), }), }) + // The real code awaits `.from().innerJoin().where()` directly (no .limit()), + // so the mock makes `.where()` itself the thenable. .mockReturnValueOnce({ from: () => ({ innerJoin: () => ({ - where: () => ({ - limit: async () => [ - { - brandId: "brand-tux", - brandName: "Tuxedo Citrus", - brandSlug: "tuxedo", - role: "brand_admin", - }, - ], - }), + where: async () => [ + { + brandId: "brand-tux", + brandName: "Tuxedo Citrus", + brandSlug: "tuxedo", + }, + ], }), }), });