fix: match root project sessions in switcher (#1274)
* fix: match root project sessions in switcher * test: cover project path matching edge cases --------- Co-authored-by: Isaac Sanchez <isanchez-hawkins@arize.com>
This commit is contained in:
committed by
GitHub
co-authored by
Isaac Sanchez
parent
9c71119835
commit
00c112077d
@@ -0,0 +1,29 @@
|
||||
import { describe, expect, test } from 'bun:test';
|
||||
|
||||
import { isPathWithinProject } from './utils';
|
||||
|
||||
describe('isPathWithinProject', () => {
|
||||
test('matches child directories for root projects', () => {
|
||||
expect(isPathWithinProject('/workspace/app', '/')).toBe(true);
|
||||
});
|
||||
|
||||
test('matches exact project directories', () => {
|
||||
expect(isPathWithinProject('/workspace/app', '/workspace/app')).toBe(true);
|
||||
});
|
||||
|
||||
test('does not match sibling directory prefixes', () => {
|
||||
expect(isPathWithinProject('/workspace/app2', '/workspace/app')).toBe(false);
|
||||
});
|
||||
|
||||
test('returns false when directory is null', () => {
|
||||
expect(isPathWithinProject(null, '/workspace/app')).toBe(false);
|
||||
});
|
||||
|
||||
test('returns false when projectPath is null', () => {
|
||||
expect(isPathWithinProject('/workspace/app', null)).toBe(false);
|
||||
});
|
||||
|
||||
test('matches deep child directories', () => {
|
||||
expect(isPathWithinProject('/workspace/app/sub/dir', '/workspace/app')).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user