test(server): compare Windows workspace identity

This commit is contained in:
Jinwoo-H
2026-08-10 00:14:11 -04:00
parent 40f8295ab6
commit 5512aba1dd
+13 -1
View File
@@ -3,6 +3,7 @@ import { mkdtempSync, realpathSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join, resolve } from 'node:path'
import { removeHostTree } from '../../src/main/host-tree-removal'
import { normalizeRuntimePathForComparison } from '../../src/shared/cross-platform-path'
import { decodePairingOffer, type PairingOffer } from '../../src/shared/pairing'
import { sendRemoteRuntimeRequest } from '../../src/shared/remote-runtime-client'
import type { RuntimeStatus, RuntimeTerminalRead } from '../../src/shared/runtime-types'
@@ -219,11 +220,22 @@ async function verifyGitWorkspace(pairing: PairingOffer): Promise<void> {
{ repo: `id:${added.repo.id}` }
)
assert(
listed.worktrees.some((worktree) => worktree.path === gitPath),
listed.worktrees.some((worktree) => isSameExistingHostPath(worktree.path, gitPath)),
'Git worktree unavailable'
)
}
function isSameExistingHostPath(left: string, right: string): boolean {
try {
return (
normalizeRuntimePathForComparison(realpathSync.native(left)) ===
normalizeRuntimePathForComparison(realpathSync.native(right))
)
} catch {
return false
}
}
async function verifyFolderWorkspaceAndTerminal(pairing: PairingOffer): Promise<{
handle: string
marker: string