import { describe, expect, it } from 'vitest'; import { projectPathsMatchForInvalidation } from '../src/features/project-summary/projectPath'; describe('项目刷新事件路径', () => { it.each([ ['C:\\Projects\\game', '\\\\?\\C:\\Projects\\game'], ['\\\\?\\C:\\Projects\\game', 'c:/Projects/game/'], ['\\\\server\\share\\game', '\\\\?\\UNC\\server\\share\\game'], ['/tmp/game', '/tmp/game'], ])('识别同一项目 %s 与 %s', (eventPath, activePath) => { expect(projectPathsMatchForInvalidation(eventPath, activePath)).toBe(true); }); it.each([ ['\\\\?\\C:\\Projects\\game-other', 'C:\\Projects\\game'], ['\\\\?\\C:\\Projects\\game\\child', 'C:\\Projects\\game'], ['\\\\?\\UNC\\other\\share\\game', '\\\\server\\share\\game'], ['\\\\.\\C:\\Projects\\game', 'C:\\Projects\\game'], ['/tmp/Game', '/tmp/game'], ['', ''], ['C:\\Projects\\game', null], ])('拒绝其它项目或空作用域 %s 与 %s', (eventPath, activePath) => { expect(projectPathsMatchForInvalidation(eventPath, activePath)).toBe(false); }); });