-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simplify userAgent assertion on result of clerkClient()
- Loading branch information
Showing
1 changed file
with
4 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import { createClerkClient } from '@clerk/backend'; | ||
import type { Mock } from 'vitest'; | ||
import { describe, expect, it, vi } from 'vitest'; | ||
|
||
import { clerkClient } from '../clerkClient'; | ||
|
@@ -13,28 +14,10 @@ vi.mock('@clerk/backend', async importOriginal => { | |
}); | ||
|
||
describe('clerkClient', () => { | ||
it('should pass version package to userAgent', async () => { | ||
const resolvedClerkClient = await clerkClient(); | ||
it('should pass package-specific userAgent', async () => { | ||
await clerkClient(); | ||
|
||
await resolvedClerkClient.users.getUser('user_test'); | ||
|
||
expect(createClerkClient).toHaveBeenCalledWith({ | ||
apiUrl: 'https://api.clerk.com', | ||
apiVersion: 'v1', | ||
domain: '', | ||
isSatellite: false, | ||
proxyUrl: '', | ||
publishableKey: '', | ||
sdkMetadata: { | ||
environment: 'test', | ||
name: '@clerk/nextjs', | ||
version: '0.0.0-test', | ||
}, | ||
secretKey: 'TEST_SECRET_KEY', | ||
telemetry: { | ||
debug: false, | ||
disabled: false, | ||
}, | ||
expect((createClerkClient as Mock).mock.lastCall?.[0]).toMatchObject({ | ||
userAgent: '@clerk/[email protected]', | ||
}); | ||
}); | ||
|