Skip to content

armgit / dbx

Public Imported from GitHub
0

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。

1.4 KB
Raw Blame
import { test } from "vitest";
import assert from "node:assert/strict";
import { canTreeNodePin, canTreeNodeShowExpander, treeLabelWidthClass } from "../../apps/desktop/src/lib/sidebar/sidebarTreeItemLayout.ts";

test("mongodb collection rows can show an expander for metadata groups", () => {
  assert.equal(canTreeNodeShowExpander({ type: "mongo-collection", childCount: 0 }), true);
});

test("ZooKeeper root rows do not show an empty expander", () => {
  assert.equal(canTreeNodeShowExpander({ type: "zookeeper-root", childCount: 0 }), false);
});

test("Nacos namespace rows can show the pin action", () => {
  assert.equal(canTreeNodePin("nacos-namespace"), true);
});

test("labels with trailing comments consume the available row width when aligned", () => {
  assert.equal(treeLabelWidthClass({ fullWidth: false, hasTrailingComment: true, alignLeading: true }), "min-w-0 flex-1 truncate");
  // inline/right 模式 label 不撑满,让 comment 紧跟
  assert.equal(treeLabelWidthClass({ fullWidth: false, hasTrailingComment: true, alignLeading: false }), "min-w-0 shrink truncate");
  assert.equal(treeLabelWidthClass({ fullWidth: false, hasTrailingComment: false }), "min-w-0 truncate");
});

test("horizontal-scroll labels keep their intrinsic width", () => {
  assert.equal(treeLabelWidthClass({ fullWidth: true, hasTrailingComment: true }), "shrink-0 whitespace-nowrap");
});