fix: 修复 ESLint 错误 — path-manager 测试去 as any、search-clean 未用参数

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-27 14:26:56 +08:00
parent 2b372cbf89
commit be04b7d0da
4 changed files with 9 additions and 4 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

+1
View File
@@ -3,6 +3,7 @@ import { test, expect } from '@playwright/test';
test.beforeEach(async ({ page }) => {
await page.addInitScript(() => {
window.__TAURI_INTERNALS__ = {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
invoke: async (cmd, args) => {
switch (cmd) {
case 'check_admin': return true;
+4
View File
@@ -0,0 +1,4 @@
{
"status": "passed",
"failedTests": []
}
+4 -4
View File
@@ -11,25 +11,25 @@ const validateFn = (path: string) => !path.includes('Invalid');
describe('pathClean', () => {
it('移除无效路径', () => {
const [kept, removed] = pathClean([pe('C:\\Valid'), pe('C:\\Invalid'), pe('D:\\Valid')], validateFn as any);
const [kept, removed] = pathClean([pe('C:\\Valid'), pe('C:\\Invalid'), pe('D:\\Valid')], validateFn);
expect(kept.map(e => e.path)).toEqual(['C:\\Valid', 'D:\\Valid']);
expect(removed.map(e => e.path)).toEqual(['C:\\Invalid']);
});
it('移除重复路径保留第一个', () => {
const [kept, removed] = pathClean([pe('C:\\Valid'), pe('C:\\Valid'), pe('D:\\Valid')], alwaysValid as any);
const [kept, removed] = pathClean([pe('C:\\Valid'), pe('C:\\Valid'), pe('D:\\Valid')], alwaysValid);
expect(kept.length).toBe(2);
expect(removed.length).toBe(1);
});
it('全部有效无变化', () => {
const [kept, removed] = pathClean([pe('C:\\a'), pe('D:\\b')], alwaysValid as any);
const [kept, removed] = pathClean([pe('C:\\a'), pe('D:\\b')], alwaysValid);
expect(kept.map(e => e.path)).toEqual(['C:\\a', 'D:\\b']);
expect(removed.length).toBe(0);
});
it('全部无效全部移除', () => {
const [kept, removed] = pathClean([pe('C:\\Invalid1'), pe('C:\\Invalid2')], validateFn as any);
const [kept, removed] = pathClean([pe('C:\\Invalid1'), pe('C:\\Invalid2')], validateFn);
expect(kept.length).toBe(0);
expect(removed.length).toBe(2);
});