feat: add DSH IDE open-file references

This commit is contained in:
2026-08-17 11:52:48 +08:00
commit d96c11ae3d
42 changed files with 6991 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
import { describe, expect, it } from 'vitest'
import { createSnapshot, deduplicateDocuments } from '../src/model.js'
describe('deduplicateDocuments', () => {
it('deduplicates Windows paths and preserves dirty state', () => {
const result = deduplicateDocuments([
{ path: 'F:\\Project\\main.ts', label: 'main.ts', dirty: false },
{ path: 'f:\\project\\MAIN.ts', label: 'MAIN.ts', dirty: true },
])
expect(result).toEqual([{ path: 'f:\\project\\MAIN.ts', label: 'MAIN.ts', dirty: true }])
})
})
describe('createSnapshot', () => {
it('creates the frozen v1 wire shape', () => {
const snapshot = createSnapshot({
instanceId: 'one', processId: 12, workspace: 'F:\\Project',
documents: [{ path: 'F:\\Project\\main.ts', label: 'main.ts', dirty: false }],
now: new Date('2026-01-01T00:00:00.000Z'),
})
expect(snapshot).toMatchObject({ version: 1, ide: 'vscode', updatedAt: '2026-01-01T00:00:00.000Z' })
})
})