mirror of
https://github.com/LHY0125/PathEditor.git
synced 2026-06-29 01:45:54 +08:00
fix: 修复 ESLint 错误 — path-manager 测试去 as any、search-clean 未用参数
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
@@ -3,6 +3,7 @@ import { test, expect } from '@playwright/test';
|
|||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
await page.addInitScript(() => {
|
await page.addInitScript(() => {
|
||||||
window.__TAURI_INTERNALS__ = {
|
window.__TAURI_INTERNALS__ = {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
invoke: async (cmd, args) => {
|
invoke: async (cmd, args) => {
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case 'check_admin': return true;
|
case 'check_admin': return true;
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"status": "passed",
|
||||||
|
"failedTests": []
|
||||||
|
}
|
||||||
@@ -11,25 +11,25 @@ const validateFn = (path: string) => !path.includes('Invalid');
|
|||||||
|
|
||||||
describe('pathClean', () => {
|
describe('pathClean', () => {
|
||||||
it('移除无效路径', () => {
|
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(kept.map(e => e.path)).toEqual(['C:\\Valid', 'D:\\Valid']);
|
||||||
expect(removed.map(e => e.path)).toEqual(['C:\\Invalid']);
|
expect(removed.map(e => e.path)).toEqual(['C:\\Invalid']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('移除重复路径保留第一个', () => {
|
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(kept.length).toBe(2);
|
||||||
expect(removed.length).toBe(1);
|
expect(removed.length).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('全部有效无变化', () => {
|
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(kept.map(e => e.path)).toEqual(['C:\\a', 'D:\\b']);
|
||||||
expect(removed.length).toBe(0);
|
expect(removed.length).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('全部无效全部移除', () => {
|
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(kept.length).toBe(0);
|
||||||
expect(removed.length).toBe(2);
|
expect(removed.length).toBe(2);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user