mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
19 lines
691 B
TypeScript
19 lines
691 B
TypeScript
import { describe, expect, test } from 'bun:test'
|
|
import { getAttributionHeader } from './system.js'
|
|
|
|
describe('getAttributionHeader', () => {
|
|
test('uses Claude Code compatibility version and always includes CCH placeholder', () => {
|
|
const originalEntrypoint = process.env.CLAUDE_CODE_ENTRYPOINT
|
|
process.env.CLAUDE_CODE_ENTRYPOINT = 'cli'
|
|
|
|
try {
|
|
expect(getAttributionHeader('abc')).toBe(
|
|
'x-anthropic-billing-header: cc_version=2.1.92.abc; cc_entrypoint=cli; cch=00000;',
|
|
)
|
|
} finally {
|
|
if (originalEntrypoint === undefined) delete process.env.CLAUDE_CODE_ENTRYPOINT
|
|
else process.env.CLAUDE_CODE_ENTRYPOINT = originalEntrypoint
|
|
}
|
|
})
|
|
})
|