Files
deepseek-harness/apps/cli/tests/telemetry-switch.spec.ts
Tianyi Cui a2d0f7f411 refactor: apply repository naming contract
Apply the accepted pre-release package, service, type, directory, and role renames as one repository-wide change.
2026-08-13 00:54:38 +08:00

23 lines
1001 B
TypeScript

import { describe, expect, it } from 'vitest'
import { resolveTelemetryPatch } from '../src/profile-boot.ts'
describe('resolveTelemetryPatch', () => {
it('preserves the configured telemetry mode when the hard-disable switch is unset or empty', () => {
expect(resolveTelemetryPatch(undefined, true)).toBeUndefined()
expect(resolveTelemetryPatch('', true)).toBeUndefined()
})
it('disables on ANY non-empty value, including falsy-looking ones', () => {
for (const value of ['1', '0', 'false', 'no']) {
expect(resolveTelemetryPatch(value, true)).toEqual({ id: 'session-telemetry-otel', disabled: true })
}
})
it('is trivially satisfied by a composition without the telemetry row', () => {
// A custom profile need not mount telemetry: nothing exports, so the
// privacy switch has nothing to disable and generates no patch.
expect(resolveTelemetryPatch('1', false)).toBeUndefined()
expect(resolveTelemetryPatch(undefined, false)).toBeUndefined()
})
})