forked from Gitlawb/openclaude
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuserAgent.test.ts
More file actions
27 lines (21 loc) · 863 Bytes
/
userAgent.test.ts
File metadata and controls
27 lines (21 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { afterEach, expect, test } from 'bun:test'
import { getClaudeCodeUserAgent, getPublicBuildVersion } from './userAgent.js'
const originalMacro = (globalThis as Record<string, unknown>).MACRO
afterEach(() => {
;(globalThis as Record<string, unknown>).MACRO = originalMacro
})
test('prefers DISPLAY_VERSION for public build version strings', () => {
;(globalThis as Record<string, unknown>).MACRO = {
VERSION: '99.0.0',
DISPLAY_VERSION: '0.7.0',
}
expect(getPublicBuildVersion()).toBe('0.7.0')
expect(getClaudeCodeUserAgent()).toBe('claude-code/99.0.0')
})
test('falls back to VERSION when DISPLAY_VERSION is unavailable', () => {
;(globalThis as Record<string, unknown>).MACRO = {
VERSION: '0.7.0-dev',
}
expect(getPublicBuildVersion()).toBe('0.7.0-dev')
expect(getClaudeCodeUserAgent()).toBe('claude-code/0.7.0-dev')
})