25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import * as http from "../http";
import * as tauri from "../tauri";
const { invoke } = vi.hoisted(() => ({ invoke: vi.fn() }));
vi.mock("@tauri-apps/api/core", () => ({ invoke, Channel: class {} }));
describe("connection visibility migration transport", () => {
const fetch = vi.fn();
beforeEach(() => {
vi.resetAllMocks();
vi.stubGlobal("fetch", fetch);
fetch.mockImplementation(async () => new Response("[]", { headers: { "Content-Type": "application/json" } }));
invoke.mockResolvedValue([]);
});
afterEach(() => vi.unstubAllGlobals());
it("keeps ordinary reads free of migration input", async () => {
await tauri.loadConnections();
expect(invoke).toHaveBeenCalledExactlyOnceWith("load_connections", undefined);
await http.loadConnections();
const url = new URL(String(fetch.mock.calls[0][0]), "http://localhost");
expect(url.pathname).toBe("/api/connection/list");
expect(url.search).toBe("");
});
it.each([false, true])("preserves an explicit legacy value of %s on both adapters", async (visible) => {
await tauri.loadConnections(visible);
expect(invoke).toHaveBeenCalledExactlyOnceWith("load_connections", { legacySidebarShowUserAdmin: visible });
await http.loadConnections(visible);
const url = new URL(String(fetch.mock.calls[0][0]), "http://localhost");
expect(url.searchParams.get("legacySidebarShowUserAdmin")).toBe(String(visible));
});
});