From 27c139de9aa6fb5e245fda41b237e38eee5f36b2 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Mon, 6 Apr 2026 20:30:30 +0200 Subject: [PATCH] fix: update OAuth service tests for userId-from-record refactor - Add userId param to createAuthorizationCode calls - Remove userId param from exchangeCode and refreshAccessToken calls (now derived from stored records) Co-Authored-By: Claude Opus 4.6 (1M context) --- tests/services/oauth.service.test.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/services/oauth.service.test.ts b/tests/services/oauth.service.test.ts index 417abe5..71df16f 100644 --- a/tests/services/oauth.service.test.ts +++ b/tests/services/oauth.service.test.ts @@ -63,6 +63,7 @@ describe("OAuth Service", () => { const result = await createAuthorizationCode( db, clientId, + userId, challenge, "S256", "http://localhost:8080/callback", @@ -82,6 +83,7 @@ describe("OAuth Service", () => { const { code } = await createAuthorizationCode( db, clientId, + userId, challenge, "S256", "http://localhost:8080/callback", @@ -93,7 +95,6 @@ describe("OAuth Service", () => { verifier, clientId, "http://localhost:8080/callback", - userId, ); expect(tokens).not.toBeNull(); @@ -113,6 +114,7 @@ describe("OAuth Service", () => { const { code } = await createAuthorizationCode( db, clientId, + userId, challenge, "S256", "http://localhost:8080/callback", @@ -124,7 +126,6 @@ describe("OAuth Service", () => { "wrongverifier", clientId, "http://localhost:8080/callback", - userId, ); expect(tokens).toBeNull(); @@ -139,6 +140,7 @@ describe("OAuth Service", () => { const { code } = await createAuthorizationCode( db, clientId, + userId, challenge, "S256", "http://localhost:8080/callback", @@ -165,6 +167,7 @@ describe("OAuth Service", () => { const { code } = await createAuthorizationCode( db, clientId, + userId, challenge, "S256", "http://localhost:8080/callback", @@ -177,7 +180,6 @@ describe("OAuth Service", () => { verifier, clientId, "http://localhost:8080/callback", - userId, ); expect(first).not.toBeNull(); @@ -188,7 +190,6 @@ describe("OAuth Service", () => { verifier, clientId, "http://localhost:8080/callback", - userId, ); expect(second).toBeNull(); }); @@ -204,6 +205,7 @@ describe("OAuth Service", () => { const { code } = await createAuthorizationCode( db, clientId, + userId, challenge, "S256", "http://localhost:8080/callback", @@ -215,7 +217,6 @@ describe("OAuth Service", () => { verifier, clientId, "http://localhost:8080/callback", - userId, ); const verified = await verifyAccessToken(db, tokens!.accessToken); @@ -239,6 +240,7 @@ describe("OAuth Service", () => { const { code } = await createAuthorizationCode( db, clientId, + userId, challenge, "S256", "http://localhost:8080/callback", @@ -250,14 +252,12 @@ describe("OAuth Service", () => { verifier, clientId, "http://localhost:8080/callback", - userId, ); const newTokens = await refreshAccessToken( db, tokens!.refreshToken, clientId, - userId, ); expect(newTokens).not.toBeNull(); @@ -275,6 +275,7 @@ describe("OAuth Service", () => { const { code } = await createAuthorizationCode( db, clientId, + userId, challenge, "S256", "http://localhost:8080/callback", @@ -286,7 +287,6 @@ describe("OAuth Service", () => { verifier, clientId, "http://localhost:8080/callback", - userId, ); const newTokens = await refreshAccessToken(