test(files): cover the review's two remaining outside-worktree cases

The symlinked .git folder test now also runs from a session in the main
checkout, as well as from a linked worktree. A new pane-watcher test
checks that an unparseable docker-cases.json follows nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Michael GrundbergandClaude Opus 5.5 committed 2026-11-06 21:13:45 +01:00
1 parent 8d33f53fd0
commit e2359aa0e8
2 files changed
+17 -1

No files matched your search

+3 -1
View File
@@ -157,7 +157,9 @@ describe('findLiveWorktree outside the session folder', () => {
const fake = join(base, 'fake');
mkdirSync(fake);
symlinkSync(join(repo, '.git'), join(fake, '.git'));
// The session is in the linked worktree, so the main-worktree branch is the one exercised.
// From a session in the main checkout.
expect(await findLiveWorktree(repo, fake, { home })).toBeUndefined();
// From a session in a linked worktree.
expect(await findLiveWorktree(sibling, fake, { home })).toBeUndefined();
// The real main worktree is still followed from the same session.
expect(await findLiveWorktree(sibling, repo, { home })).toEqual({ name: 'myapp', path: repo, outside: true });
+14
View File
@@ -491,6 +491,20 @@ describe('a pane read reaching the session record', () => {
}
});
it('follows nothing while docker-cases.json cannot be parsed', async () => {
const casesFile = dataPath('docker-cases.json');
mkdirSync(dirname(casesFile), { recursive: true });
try {
// A read that lands while the writer is rewriting the file.
writeFileSync(casesFile, '[{"hostWorkspacePath": "/hom');
expect(await paneInSibling()).toBeUndefined();
writeFileSync(casesFile, '[]');
expect(await paneInSibling()).toEqual({ name: 'myapp-feature', path: sibling, outside: true });
} finally {
rmSync(casesFile, { force: true });
}
});
it('applies the owner folder rule in multi-user mode', async () => {
const spaces = join(base, 'spaces');
mkdirSync(spaces);