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) <noreply@anthropic.com>
This commit is contained in:
@@ -63,6 +63,7 @@ describe("OAuth Service", () => {
|
|||||||
const result = await createAuthorizationCode(
|
const result = await createAuthorizationCode(
|
||||||
db,
|
db,
|
||||||
clientId,
|
clientId,
|
||||||
|
userId,
|
||||||
challenge,
|
challenge,
|
||||||
"S256",
|
"S256",
|
||||||
"http://localhost:8080/callback",
|
"http://localhost:8080/callback",
|
||||||
@@ -82,6 +83,7 @@ describe("OAuth Service", () => {
|
|||||||
const { code } = await createAuthorizationCode(
|
const { code } = await createAuthorizationCode(
|
||||||
db,
|
db,
|
||||||
clientId,
|
clientId,
|
||||||
|
userId,
|
||||||
challenge,
|
challenge,
|
||||||
"S256",
|
"S256",
|
||||||
"http://localhost:8080/callback",
|
"http://localhost:8080/callback",
|
||||||
@@ -93,7 +95,6 @@ describe("OAuth Service", () => {
|
|||||||
verifier,
|
verifier,
|
||||||
clientId,
|
clientId,
|
||||||
"http://localhost:8080/callback",
|
"http://localhost:8080/callback",
|
||||||
userId,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(tokens).not.toBeNull();
|
expect(tokens).not.toBeNull();
|
||||||
@@ -113,6 +114,7 @@ describe("OAuth Service", () => {
|
|||||||
const { code } = await createAuthorizationCode(
|
const { code } = await createAuthorizationCode(
|
||||||
db,
|
db,
|
||||||
clientId,
|
clientId,
|
||||||
|
userId,
|
||||||
challenge,
|
challenge,
|
||||||
"S256",
|
"S256",
|
||||||
"http://localhost:8080/callback",
|
"http://localhost:8080/callback",
|
||||||
@@ -124,7 +126,6 @@ describe("OAuth Service", () => {
|
|||||||
"wrongverifier",
|
"wrongverifier",
|
||||||
clientId,
|
clientId,
|
||||||
"http://localhost:8080/callback",
|
"http://localhost:8080/callback",
|
||||||
userId,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(tokens).toBeNull();
|
expect(tokens).toBeNull();
|
||||||
@@ -139,6 +140,7 @@ describe("OAuth Service", () => {
|
|||||||
const { code } = await createAuthorizationCode(
|
const { code } = await createAuthorizationCode(
|
||||||
db,
|
db,
|
||||||
clientId,
|
clientId,
|
||||||
|
userId,
|
||||||
challenge,
|
challenge,
|
||||||
"S256",
|
"S256",
|
||||||
"http://localhost:8080/callback",
|
"http://localhost:8080/callback",
|
||||||
@@ -165,6 +167,7 @@ describe("OAuth Service", () => {
|
|||||||
const { code } = await createAuthorizationCode(
|
const { code } = await createAuthorizationCode(
|
||||||
db,
|
db,
|
||||||
clientId,
|
clientId,
|
||||||
|
userId,
|
||||||
challenge,
|
challenge,
|
||||||
"S256",
|
"S256",
|
||||||
"http://localhost:8080/callback",
|
"http://localhost:8080/callback",
|
||||||
@@ -177,7 +180,6 @@ describe("OAuth Service", () => {
|
|||||||
verifier,
|
verifier,
|
||||||
clientId,
|
clientId,
|
||||||
"http://localhost:8080/callback",
|
"http://localhost:8080/callback",
|
||||||
userId,
|
|
||||||
);
|
);
|
||||||
expect(first).not.toBeNull();
|
expect(first).not.toBeNull();
|
||||||
|
|
||||||
@@ -188,7 +190,6 @@ describe("OAuth Service", () => {
|
|||||||
verifier,
|
verifier,
|
||||||
clientId,
|
clientId,
|
||||||
"http://localhost:8080/callback",
|
"http://localhost:8080/callback",
|
||||||
userId,
|
|
||||||
);
|
);
|
||||||
expect(second).toBeNull();
|
expect(second).toBeNull();
|
||||||
});
|
});
|
||||||
@@ -204,6 +205,7 @@ describe("OAuth Service", () => {
|
|||||||
const { code } = await createAuthorizationCode(
|
const { code } = await createAuthorizationCode(
|
||||||
db,
|
db,
|
||||||
clientId,
|
clientId,
|
||||||
|
userId,
|
||||||
challenge,
|
challenge,
|
||||||
"S256",
|
"S256",
|
||||||
"http://localhost:8080/callback",
|
"http://localhost:8080/callback",
|
||||||
@@ -215,7 +217,6 @@ describe("OAuth Service", () => {
|
|||||||
verifier,
|
verifier,
|
||||||
clientId,
|
clientId,
|
||||||
"http://localhost:8080/callback",
|
"http://localhost:8080/callback",
|
||||||
userId,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const verified = await verifyAccessToken(db, tokens!.accessToken);
|
const verified = await verifyAccessToken(db, tokens!.accessToken);
|
||||||
@@ -239,6 +240,7 @@ describe("OAuth Service", () => {
|
|||||||
const { code } = await createAuthorizationCode(
|
const { code } = await createAuthorizationCode(
|
||||||
db,
|
db,
|
||||||
clientId,
|
clientId,
|
||||||
|
userId,
|
||||||
challenge,
|
challenge,
|
||||||
"S256",
|
"S256",
|
||||||
"http://localhost:8080/callback",
|
"http://localhost:8080/callback",
|
||||||
@@ -250,14 +252,12 @@ describe("OAuth Service", () => {
|
|||||||
verifier,
|
verifier,
|
||||||
clientId,
|
clientId,
|
||||||
"http://localhost:8080/callback",
|
"http://localhost:8080/callback",
|
||||||
userId,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const newTokens = await refreshAccessToken(
|
const newTokens = await refreshAccessToken(
|
||||||
db,
|
db,
|
||||||
tokens!.refreshToken,
|
tokens!.refreshToken,
|
||||||
clientId,
|
clientId,
|
||||||
userId,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(newTokens).not.toBeNull();
|
expect(newTokens).not.toBeNull();
|
||||||
@@ -275,6 +275,7 @@ describe("OAuth Service", () => {
|
|||||||
const { code } = await createAuthorizationCode(
|
const { code } = await createAuthorizationCode(
|
||||||
db,
|
db,
|
||||||
clientId,
|
clientId,
|
||||||
|
userId,
|
||||||
challenge,
|
challenge,
|
||||||
"S256",
|
"S256",
|
||||||
"http://localhost:8080/callback",
|
"http://localhost:8080/callback",
|
||||||
@@ -286,7 +287,6 @@ describe("OAuth Service", () => {
|
|||||||
verifier,
|
verifier,
|
||||||
clientId,
|
clientId,
|
||||||
"http://localhost:8080/callback",
|
"http://localhost:8080/callback",
|
||||||
userId,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const newTokens = await refreshAccessToken(
|
const newTokens = await refreshAccessToken(
|
||||||
|
|||||||
Reference in New Issue
Block a user