22 lines
727 B
TypeScript
22 lines
727 B
TypeScript
import { describe, expect, test } from 'bun:test';
|
|||
|
|
import { resolveProjectForSessionDirectory } from './projectResolution';
|
||
|
|
|
||
|
|
const projects = [
|
||
|
|
{ id: 'openchamber', path: '/workspace/openchamber', label: 'OpenChamber' },
|
||
|
|
];
|
||
|
|
|
||
|
|
describe('resolveProjectForSessionDirectory', () => {
|
||
|
|
test('resolves a sibling worktree to its registered project', () => {
|
||
|
|
const worktrees = new Map([
|
||
|
|
['/workspace/openchamber', [{
|
||
|
|
path: '/workspace/openchamber-feature',
|
||
|
|
projectDirectory: '/workspace/openchamber',
|
||
|
|
branch: 'feature',
|
||
|
|
label: 'feature',
|
||
|
|
}]],
|
||
|
|
]);
|
||
|
|
|
||
|
|
expect(resolveProjectForSessionDirectory(projects, worktrees, '/workspace/openchamber-feature')).toEqual(projects[0]);
|
||
|
|
});
|
||
|
|
});
|