test(editor): lock POSIX ancestor-backslash destination flavor

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Neil
2026-07-21 00:38:59 -07:00
co-authored by Orca
parent bda8bc9321
commit e10cfc33ac
@@ -307,6 +307,30 @@ describe('remapOpenEditorTabsForPathChange', () => {
expect(useAppStore.getState().openFiles[0]!.filePath).toBe('/repo/dst/a\\b.txt')
})
it('keeps `/` for a POSIX destination whose ancestor contains a legal backslash', () => {
const state = useAppStore.getState()
state.openFile(
{
filePath: '/srv/team\\repo/src/a.ts',
relativePath: 'src/a.ts',
worktreeId: 'wt-1',
language: 'typescript',
mode: 'edit'
},
{ suppressActiveRuntimeFallback: true }
)
remapOpenEditorTabsForPathChange({
fromPath: '/srv/team\\repo/src',
toPath: '/srv/team\\repo/dst',
worktreePath: '/srv/team\\repo',
worktreeId: 'wt-1'
})
// POSIX flavor: the separator stays `/`; the ancestor backslash is untouched.
expect(useAppStore.getState().openFiles[0]!.filePath).toBe('/srv/team\\repo/dst/a.ts')
})
it('rebuilds the moved path when the source root has duplicate separators', () => {
const state = useAppStore.getState()
state.openFile(