Skip to content

Commit b742544

Browse files
committed
fix: test case fix when useDpop is false
1 parent 23c805e commit b742544

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

src/server/auth-client.test.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9456,14 +9456,16 @@ ykwV8CV22wKDubrDje1vchfTL/ygX6p27RKpJm8eAH7k3EwVeg3NDfNVzQ==
94569456
warnSpy.mockRestore();
94579457
});
94589458

9459-
it("should defer validation when useDPoP is false", async () => {
9459+
it("should skip DPoP validation entirely when useDPoP is false", async () => {
94609460
process.env[ENV_VARS.DPOP_PRIVATE_KEY] = TEST_PRIVATE_KEY_PEM;
94619461
process.env[ENV_VARS.DPOP_PUBLIC_KEY] = TEST_PUBLIC_KEY_PEM;
94629462

94639463
const secret = await generateSecret(32);
94649464
const transactionStore = new TransactionStore({ secret });
94659465
const sessionStore = new StatelessSessionStore({ secret });
94669466

9467+
const warnSpy = vi.spyOn(console, "warn");
9468+
94679469
const authClient = new AuthClient({
94689470
transactionStore,
94699471
sessionStore,
@@ -9473,10 +9475,20 @@ ykwV8CV22wKDubrDje1vchfTL/ygX6p27RKpJm8eAH7k3EwVeg3NDfNVzQ==
94739475
secret,
94749476
appBaseUrl: DEFAULT.appBaseUrl,
94759477
routes: getDefaultRoutes(),
9476-
useDPoP: false
9478+
useDPoP: false,
9479+
fetch: getMockAuthorizationServer()
94779480
});
94789481

94799482
expect(authClient).toBeInstanceOf(AuthClient);
9483+
9484+
// Trigger operations that would validate DPoP if it were enabled
9485+
await expect(authClient.startInteractiveLogin()).resolves.toBeDefined();
9486+
9487+
// Verify NO DPoP-related warnings were issued - validation was completely skipped
9488+
expect(warnSpy).not.toHaveBeenCalledWith(expect.stringContaining("DPoP"));
9489+
expect(warnSpy).not.toHaveBeenCalledWith(expect.stringContaining("dpop"));
9490+
9491+
warnSpy.mockRestore();
94809492
});
94819493

94829494
it("should handle missing private key only from environment variables", async () => {

0 commit comments

Comments
 (0)