mirror of
https://github.com/LHY0125/PathEditor.git
synced 2026-06-29 01:45:54 +08:00
fix: E2E mock 统一 + CSV 引号字段解析
E2E:
- createIpcMock 支持 overrides 参数,保持 default: throw 行为
- search-clean.spec.ts 删除 30 行内联 mock,改用 createIpcMock(overrides)
Rust:
- 新增 parse_csv_line: 支持引号包裹字段 + 双引号转义 (RFC 4180 子集)
- import_csv 改用 parse_csv_line 替代 split(',')
- 与 TS 端 parseCsvLine 逻辑对称
测试: Rust 48 → 52 (+4), Frontend 100
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,28 +1,12 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { createIpcMock } from '../mocks/ipc';
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.addInitScript(() => {
|
||||
window.__TAURI_INTERNALS__ = {
|
||||
invoke: async (cmd, _args) => {
|
||||
switch (cmd) {
|
||||
case 'check_admin': return true;
|
||||
case 'load_system_paths': return ['C:\\\\Windows', 'invalid_path', 'C:\\\\Temp'];
|
||||
case 'load_user_paths': return [];
|
||||
case 'load_disabled_state': return { system: [], user: [] };
|
||||
case 'save_system_paths': return undefined;
|
||||
case 'save_user_paths': return undefined;
|
||||
case 'save_disabled_state': return undefined;
|
||||
case 'backup_registry': return '';
|
||||
case 'broadcast_env_change': return undefined;
|
||||
case 'validate_path': return false;
|
||||
case 'expand_env_vars': return '';
|
||||
case 'read_text_file': return '';
|
||||
case 'get_appdata_dir': return '';
|
||||
default: return undefined;
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
await page.addInitScript(createIpcMock({
|
||||
load_system_paths: ['C:\\Windows', 'invalid_path', 'C:\\Temp'],
|
||||
load_user_paths: [],
|
||||
validate_path: false,
|
||||
}));
|
||||
await page.goto('/');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user