Skip to content

Commit

Permalink
simplify userAgent assertion on result of clerkClient()
Browse files Browse the repository at this point in the history
  • Loading branch information
BRKalow committed Oct 31, 2024
1 parent 5563219 commit 41e5330
Showing 1 changed file with 4 additions and 21 deletions.
25 changes: 4 additions & 21 deletions packages/nextjs/src/server/__tests__/clerkClient.test.ts
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';
Expand All @@ -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]',
});
});
Expand Down

0 comments on commit 41e5330

Please sign in to comment.