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 { strict as assert } from "node:assert";
import { test } from "vitest";
import { closeAllTabsState, closeOtherTabsState } from "../../apps/desktop/src/lib/tabs/tabCloseActions.ts";
test("close other tabs keeps the target tab and makes it active", () => {
const tabs = [{ id: "a" }, { id: "b" }, { id: "c" }];
const result = closeOtherTabsState(tabs, "a", "b");
assert.deepEqual(
result.tabs.map((tab) => tab.id),
["b"],
);
assert.equal(result.activeTabId, "b");
assert.deepEqual(
tabs.map((tab) => tab.id),
["a", "b", "c"],
);
});
test("close other tabs is a no-op when the target tab is missing", () => {
const tabs = [{ id: "a" }, { id: "b" }];
const result = closeOtherTabsState(tabs, "a", "missing");
assert.deepEqual(
result.tabs.map((tab) => tab.id),
["a", "b"],
);
assert.equal(result.activeTabId, "a");
});
test("close all tabs clears every tab and active tab", () => {
const result = closeAllTabsState([{ id: "a" }, { id: "b" }], "a");
assert.deepEqual(result.tabs, []);
assert.equal(result.activeTabId, null);
});