mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 22:35:51 +00:00
28 lines
1011 B
TypeScript
28 lines
1011 B
TypeScript
import { describe, expect, test } from 'bun:test'
|
|
import { buildSelectionChangedParams } from '../src/server/selectionPublisher.js'
|
|
|
|
describe('selection publisher helpers', () => {
|
|
test('serializes a selected range with text and file path', () => {
|
|
const params = buildSelectionChangedParams({
|
|
filePath: 'D:/vibe/claude-code/src/cli/print.ts',
|
|
text: 'const value = 1',
|
|
start: { line: 10, character: 2 },
|
|
end: { line: 10, character: 17 },
|
|
})
|
|
|
|
expect(params.filePath).toBe('D:/vibe/claude-code/src/cli/print.ts')
|
|
expect(params.text).toBe('const value = 1')
|
|
expect(params.selection?.start.line).toBe(10)
|
|
expect(params.selection?.end.character).toBe(17)
|
|
})
|
|
|
|
test('keeps file context when there is no active selection', () => {
|
|
const params = buildSelectionChangedParams({
|
|
filePath: 'D:/vibe/claude-code/src/cli/print.ts',
|
|
})
|
|
|
|
expect(params.filePath).toBe('D:/vibe/claude-code/src/cli/print.ts')
|
|
expect(params.selection).toBeNull()
|
|
})
|
|
})
|