From 418134cc1c40bb35aa5b27d0ff2837014be9ba16 Mon Sep 17 00:00:00 2001 From: Taesu Date: Wed, 24 Dec 2025 05:02:44 +0900 Subject: [PATCH] test: add test case for authorizationEndpoint --- test/unit/oauth/index.spec.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/unit/oauth/index.spec.ts b/test/unit/oauth/index.spec.ts index 0390d47881..69ee6e711d 100644 --- a/test/unit/oauth/index.spec.ts +++ b/test/unit/oauth/index.spec.ts @@ -139,3 +139,32 @@ test("should login with google successfully", async () => { invitedBy: "user-123", }); }); + +test("should use custom authorizationEndpoint when provided", async () => { + const customAuthEndpoint = "http://localhost:8080/custom-oauth/authorize"; + + const { client } = await getTestInstance({ + secret: DEFAULT_SECRET, + socialProviders: { + google: { + clientId: "test-client-id", + clientSecret: "test-client-secret", + authorizationEndpoint: customAuthEndpoint, + }, + }, + }); + + const signInRes = await client.signIn.social({ + provider: "google", + callbackURL: "/dashboard", + }); + + expect(signInRes.data).toMatchObject({ + url: expect.stringContaining(customAuthEndpoint), + redirect: true, + }); + + // Verify it uses custom endpoint instead of default google.com + expect(signInRes.data?.url).not.toContain("accounts.google.com"); + expect(signInRes.data?.url).toContain("localhost:8080"); +});