fix(files): match Windows prefixes case-insensitively (#1208)

* fix(files): match Windows prefixes case-insensitively

* fix(files): remove Windows paths case-insensitively

---------

Co-authored-by: Isaac Sanchez <isanchez-hawkins@arize.com>
This commit is contained in:
Isaac Sanchez-Hawkins
2026-05-12 10:56:53 +03:00
committed by GitHub
co-authored by Isaac Sanchez
parent 5e6207606c
commit 291ff98f18
2 changed files with 50 additions and 6 deletions
@@ -0,0 +1,36 @@
import { beforeEach, describe, expect, test } from 'bun:test';
import { useFilesViewTabsStore } from './useFilesViewTabsStore';
describe('useFilesViewTabsStore Windows paths', () => {
beforeEach(() => {
useFilesViewTabsStore.setState({ byRoot: {} });
});
test('removes open paths by prefix case-insensitively for Windows drive paths', () => {
const root = 'C:/Repo';
const store = useFilesViewTabsStore.getState();
store.addOpenPath(root, 'C:/Repo/src/a.ts');
store.addOpenPath(root, 'C:/Repo/other.ts');
store.setSelectedPath(root, 'C:/Repo/src/a.ts');
store.removeOpenPathsByPrefix(root, 'c:/repo/src');
const rootState = useFilesViewTabsStore.getState().byRoot[root];
expect(rootState?.openPaths).toEqual(['C:/Repo/other.ts']);
expect(rootState?.selectedPath).toBe('C:/Repo/other.ts');
});
test('removes a single open path case-insensitively for Windows drive paths', () => {
const root = 'C:/Repo';
const store = useFilesViewTabsStore.getState();
store.addOpenPath(root, 'C:/Repo/src/a.ts');
store.addOpenPath(root, 'C:/Repo/other.ts');
store.setSelectedPath(root, 'C:/Repo/src/a.ts');
store.removeOpenPath(root, 'c:/repo/src/a.ts');
const rootState = useFilesViewTabsStore.getState().byRoot[root];
expect(rootState?.openPaths).toEqual(['C:/Repo/other.ts']);
expect(rootState?.selectedPath).toBe('C:/Repo/other.ts');
});
});