mirror of
https://github.com/stablyai/orca.git
synced 2026-09-23 00:02:29 +00:00
* fix(mobile): open agent-cited external chat files * fix(mobile): keep cited external files read-only * refactor(mobile): derive cited-file mode from provenance * fix(mobile): accept sentence-final cited paths * fix(mobile): preserve cited SSH grant scope * refactor(file-links): share location suffix parsing
32 lines
947 B
TypeScript
32 lines
947 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { parseFileLinkLocation } from './file-link-location'
|
|
|
|
describe('parseFileLinkLocation', () => {
|
|
it('parses agent-style line and column suffixes', () => {
|
|
expect(parseFileLinkLocation('src/main.ts:12:4')).toEqual({
|
|
pathText: 'src/main.ts',
|
|
line: 12,
|
|
column: 4
|
|
})
|
|
expect(parseFileLinkLocation('src/main.ts')).toEqual({
|
|
pathText: 'src/main.ts',
|
|
line: null,
|
|
column: null
|
|
})
|
|
})
|
|
|
|
it('preserves Windows drive colons', () => {
|
|
expect(parseFileLinkLocation(String.raw`C:\repo\src\main.ts:12`)).toEqual({
|
|
pathText: String.raw`C:\repo\src\main.ts`,
|
|
line: 12,
|
|
column: null
|
|
})
|
|
})
|
|
|
|
it('rejects empty paths and zero locations', () => {
|
|
expect(parseFileLinkLocation('')).toBeNull()
|
|
expect(parseFileLinkLocation('src/main.ts:0')).toBeNull()
|
|
expect(parseFileLinkLocation('src/main.ts:12:0')).toBeNull()
|
|
})
|
|
})
|