From 6dcaa1dad4bbea38ddbd85267ab338e484811011 Mon Sep 17 00:00:00 2001 From: Gustavo Valverde Date: Thu, 15 Oct 2026 16:24:08 +0100 Subject: [PATCH] test(oauth-provider): skip the serial-id approval case on MongoDB --- .../src/client-approval.test.ts | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/packages/oauth-provider/src/client-approval.test.ts b/packages/oauth-provider/src/client-approval.test.ts index 1db76c7baa..6c3c31eeb6 100644 --- a/packages/oauth-provider/src/client-approval.test.ts +++ b/packages/oauth-provider/src/client-approval.test.ts @@ -386,21 +386,25 @@ describe.each(adapters)("approvePendingClient on %s", (testWith) => { expect(await t.consents(clientId)).toHaveLength(0); }); - it("approves a client when ids are serial", async () => { - const t = await createInstance( - testWith, - { approvePendingClient: () => ({ clientReference: "business_1" }) }, - { database: { generateId: "serial" } }, - ); - const { clientId } = await t.registerPending(); - const { headers } = await t.signInWithTestUser(); - const { location } = await t.authorize(clientId, headers); - const result = await t.consent(location, headers); - expect(result.status).toBe(200); - const stored = await t.row(clientId); - expect(stored?.pending).toBe(false); - expect(stored?.referenceId).toBe("business_1"); - }); + // MongoDB ids are ObjectIds or UUIDs, never serial. + it.skipIf(testWith === "mongodb")( + "approves a client when ids are serial", + async () => { + const t = await createInstance( + testWith, + { approvePendingClient: () => ({ clientReference: "business_1" }) }, + { database: { generateId: "serial" } }, + ); + const { clientId } = await t.registerPending(); + const { headers } = await t.signInWithTestUser(); + const { location } = await t.authorize(clientId, headers); + const result = await t.consent(location, headers); + expect(result.status).toBe(200); + const stored = await t.row(clientId); + expect(stored?.pending).toBe(false); + expect(stored?.referenceId).toBe("business_1"); + }, + ); it("redirects a refusal to the client with access_denied and stores nothing", async () => { const t = await createInstance(testWith, {