Files
orca/src/main/worktree-path-comparison-key.test.ts
T
Neil f47337d852 refactor(worktree): one worktree path equality; the ipc copy folded WSL ext4 tails (#30227)
src/main/ipc/worktree-path-comparison.ts kept its own areWorktreePathsEqual and
dedupeWorktreesByPath. Its Windows branch lowercased a WSL UNC path's ext4 tail, so two
case-twin WSL checkouts merged into one row in removal safety, folder-upgrade dedupe and
the SSH listing fallback. Every caller now uses git/worktree-path-comparison, which gains
the macOS /private/tmp fold the ipc copy had. worktreePathComparisonKey keeps its exact
bytes (retirement namespace keys persist it) in worktree-path-comparison-key.ts, and the
worktree-logic re-export goes.
2026-10-18 00:02:29 -07:00

24 lines
1.1 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { worktreePathComparisonKey } from './worktree-path-comparison-key'
// Retirement namespace keys persist these bytes; a change orphans saved retired names.
describe('worktreePathComparisonKey bytes', () => {
it.each<[string, NodeJS.Platform, string]>([
['/home/dev/Repo/', 'linux', 'posix:/home/dev/Repo'],
['/home/dev/./a/../Repo', 'win32', 'posix:/home/dev/Repo'],
['/private/tmp/orca/feature', 'darwin', 'posix:/tmp/orca/feature'],
['/private/tmp', 'darwin', 'posix:/tmp'],
['/private/tmp/orca/feature', 'linux', 'posix:/private/tmp/orca/feature'],
['C:/Workspaces/Feature', 'darwin', 'windows:c:\\workspaces\\feature'],
['\\\\Server\\Share\\Feature', 'linux', 'windows:\\\\server\\share\\feature'],
['//server/share/Feature', 'darwin', 'windows:\\\\server\\share\\feature'],
[
'\\\\wsl.localhost\\Ubuntu\\home\\dev\\Feature',
'win32',
'windows:\\\\wsl.localhost\\ubuntu\\home\\dev\\feature'
]
])('keys %s on %s', (pathValue, platform, expected) => {
expect(worktreePathComparisonKey(pathValue, platform)).toBe(expected)
})
})