同步完整源码至远程:扁平化重构现状 + 未入库源文件

- 补入库:server/internal/db/dump.go、redis 分页/扫描预算测试、opsxdb-mcp main_test、
  packages/opsxdb-mcp package-lock、docs 审计与对比文档等 37 个新文件
- 含结构扁平化进行中的 80 处修改与 155 处旧结构删除(server/ src/ src-tauri/ 为当前有效源)
- 构建产物(bin/target/dist)与签名私钥仍按规则排除
This commit is contained in:
logan committed 2026-10-16 03:47:33 +08:00
1 parent 5c0be49217
commit 2c0bfafd8d
269 files changed
+10372 -16435

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
import { describe, expect, it } from "vitest";
import { cellPreview, compareCells, filterRows, suggestedColumnWidth } from "./resultView";
describe("结果展示边界", () => {
it("大整数文本排序不丢精度", () => {
expect(compareCells("9007199254740993", "9007199254740992")).toBe(1);
expect(compareCells("-9007199254740993", "-9007199254740992")).toBe(-1);
expect(compareCells(null, "")).toBe(-1);
expect(compareCells("1.2", "1.11")).toBeGreaterThan(0);
expect(compareCells("1e3", "999")).toBeGreaterThan(0);
});
it("本地筛选覆盖 NULL、JSON、布尔值,不修改原数组", () => {
const rows = [{ x: null }, { x: { name: "Alice" } }, { x: false }, { x: "" }];
expect(filterRows(rows, ["x"], "alice")).toEqual([rows[1]]);
expect(filterRows(rows, ["x"], "NULL")).toEqual([rows[0]]);
expect(filterRows(rows, ["x"], "false")).toEqual([rows[2]]);
expect(filterRows(rows, ["x"], " ")).toBe(rows);
expect(rows).toHaveLength(4);
});
it("长 JSON 与文本都截断预览,原值保留", () => {
const value = { text: "x".repeat(500) };
expect(cellPreview(value)).toHaveLength(121);
expect(value.text).toHaveLength(500);
expect(cellPreview(false)).toBe("false");
expect(cellPreview(0)).toBe("0");
});
it("自动列宽有上下限并考虑中文宽度", () => {
expect(suggestedColumnWidth("id", [])).toBe(88);
expect(suggestedColumnWidth("数据", [{ 数据: "中".repeat(100) }])).toBe(480);
expect(suggestedColumnWidth("name", [{ name: "中国数据库" }])).toBeGreaterThan(88);
});
});