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。

fix(test): update sidebar target test for query-context type

t8y22a696be49a4c
diff --git a/packages/app-tests/sidebarActiveTabTarget.test.ts b/packages/app-tests/sidebarActiveTabTarget.test.ts
index 979151c5d4..469c3263b4 100644
--- a/packages/app-tests/sidebarActiveTabTarget.test.ts
+++ b/packages/app-tests/sidebarActiveTabTarget.test.ts
@@ -81,7 +81,7 @@ test("saved SQL tabs target the matching visible saved SQL file node", () => {
assert.equal(findSidebarNodeForActiveTab(tab, [flat(file)])?.id, "file-node");
});
-test("query tabs without a saved SQL file have no sidebar target", () => {
+test("query tabs target their database node in the sidebar", () => {
const tab: QueryTab = {
id: "tab-1",
title: "Query 1",
@@ -92,10 +92,27 @@ test("query tabs without a saved SQL file have no sidebar target", () => {
mode: "query",
};
- assert.equal(activeTabSidebarTarget(tab), null);
- assert.equal(findSidebarNodeForActiveTab(tab, []), null);
+ assert.deepEqual(activeTabSidebarTarget(tab), {
+ type: "query-context",
+ connectionId: "conn-1",
+ database: "app",
+ schema: undefined,
+ });
});
+test("query tabs without connectionId have no sidebar target", () => {
+ const tab: QueryTab = {
+ id: "tab-1",
+ title: "Query 1",
+ connectionId: "",
+ database: "",
+ sql: "select 1",
+ isExecuting: false,
+ mode: "query",
+ };
+
+ assert.equal(activeTabSidebarTarget(tab), null);
+});
test("sidebar target lookup only uses the current flat visible tree", () => {
const tab: QueryTab = {
id: "tab-1",