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:
2026-05-29 23:51:28 +08:00
parent 461ef231e4
commit bce2dc8641
3 changed files with 77 additions and 28 deletions
+5 -1
View File
@@ -1,7 +1,11 @@
export function createIpcMock() {
export type IpcOverrides = Partial<Record<string, unknown>>;
export function createIpcMock(overrides: IpcOverrides = {}) {
return `
window.__TAURI_INTERNALS__ = {
invoke: async (cmd, args) => {
const overrides = ${JSON.stringify(overrides)};
if (cmd in overrides) return overrides[cmd];
switch (cmd) {
case 'check_admin': return true;
case 'load_system_paths': return ['C:\\\\Windows', 'C:\\\\Program Files'];