import { beforeEach, describe, expect, test } from 'bun:test'; import { useFilesViewTabsStore } from './useFilesViewTabsStore'; describe('useFilesViewTabsStore', () => { beforeEach(() => { useFilesViewTabsStore.setState({ byRoot: {} }); }); test('ignores runtime paths outside the requested root', () => { const root = '/repo'; const store = useFilesViewTabsStore.getState(); store.addOpenPath(root, '/other/file.ts'); store.setSelectedPath(root, '/other/file.ts'); store.expandPath(root, '/other'); store.toggleExpandedPath(root, '/other'); expect(useFilesViewTabsStore.getState().byRoot).toEqual({}); }); test('filters expanded path batches to the requested root', () => { const root = '/repo'; useFilesViewTabsStore.getState().expandPaths(root, [ '/repo/src', '/other/src', ]); expect(useFilesViewTabsStore.getState().byRoot[root]?.expandedPaths).toEqual(['/repo/src']); }); });