Skip to content

Commit 9993f00

Browse files
committed
fix tests and add changeset
1 parent 0d9d7aa commit 9993f00

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.changeset/open-swans-count.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@clerk/backend': patch
3+
'@clerk/nextjs': patch
4+
---
5+
6+
Respect `acceptsToken` when returning unauthenticated session or machine object.

packages/express/src/__tests__/getAuth.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('getAuth', () => {
4040
it('returns an unauthenticated auth object when the tokenType does not match acceptsToken', () => {
4141
const req = mockRequestWithAuth({ tokenType: 'session_token', userId: 'user_12345' });
4242
const result = getAuth(req, { acceptsToken: 'api_key' });
43-
expect(result.tokenType).toBe('session_token'); // reflects the actual token found
43+
expect(result.tokenType).toBe('api_key'); // reflects the actual token found
4444
// Properties specific to authenticated objects should be null or undefined
4545
expect(result.userId).toBeNull();
4646
expect(result.orgId).toBeNull();

packages/fastify/src/__tests__/getAuth.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('getAuth(req)', () => {
3737
it('returns an unauthenticated auth object when the tokenType does not match acceptsToken', () => {
3838
const req = { auth: { tokenType: 'session_token', userId: 'user_12345' } } as unknown as FastifyRequest;
3939
const result = getAuth(req, { acceptsToken: 'api_key' });
40-
expect(result.tokenType).toBe('session_token'); // reflects the actual token found
40+
expect(result.tokenType).toBe('api_key'); // reflects the actual token found
4141
expect(result.userId).toBeNull();
4242
expect(result.orgId).toBeNull();
4343
});

0 commit comments

Comments
 (0)