2026-08-17 11:52:48 +08:00
|
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
|
import { candidateFromItem, serializeIdeReference } from '../src/client.js'
|
|
|
|
|
|
|
|
|
|
const item = {
|
|
|
|
|
path: 'F:\\project\\a&b.ts',
|
|
|
|
|
label: 'a&b.ts',
|
|
|
|
|
dirty: true,
|
|
|
|
|
ide: 'vscode' as const,
|
|
|
|
|
instanceId: 'one',
|
|
|
|
|
workspace: 'F:\\project',
|
|
|
|
|
instanceOpenCount: 4,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
describe('client reference projection', () => {
|
|
|
|
|
it('keeps the path in a structured JSON payload', () => {
|
|
|
|
|
expect(serializeIdeReference(item.path)).toBe('<ide-open-file>{"path":"F:\\\\project\\\\a&b.ts"}</ide-open-file>')
|
|
|
|
|
})
|
|
|
|
|
|
2026-08-17 13:55:12 +08:00
|
|
|
it('shows IDE, workspace, count and dirty state with ASCII separators', () => {
|
|
|
|
|
expect(candidateFromItem(item).description).toBe('VS Code | F:\\project | 4 open | unsaved changes')
|
2026-08-17 11:52:48 +08:00
|
|
|
})
|
|
|
|
|
})
|