fix(sidebar): preserve expansion after object rename

This commit is contained in:
t8y2
2026-05-18 22:17:45 +08:00
parent 94eeb38d63
commit b424816f74
2 changed files with 21 additions and 8 deletions
@@ -0,0 +1,20 @@
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { join } from "node:path";
import test from "node:test";
const treeItemSource = readFileSync(join(process.cwd(), "apps/desktop/src/components/sidebar/TreeItem.vue"), "utf8");
function extractRefreshTableListBody(): string {
const match = treeItemSource.match(/async function refreshTableList\(node: TreeNode\) \{([\s\S]*?)\n\}/);
assert.ok(match, "TreeItem.vue should define refreshTableList");
return match[1]!;
}
test("object mutations refresh through the expansion-preserving object list path", () => {
const body = extractRefreshTableListBody();
assert.match(body, /refreshObjectListTreeNode/);
assert.doesNotMatch(body, /loadTables\(/);
assert.doesNotMatch(body, /loadSqlServerDatabaseObjects\(/);
});