fix(tests): remove low-value source snapshots and define test standards

This commit is contained in:
t8y2 committed 2026-09-11 11:51:24 +08:00
1 parent ead906477f
commit 8186c697d5
80 files changed
+14 -2225

No files matched your search

@@ -1,56 +0,0 @@
import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
const searchableSelectSource = readFileSync(new URL("../../../components/ui/searchable-select/SearchableSelect.vue", import.meta.url), "utf8");
const editorSettingsDialogSource = readFileSync(new URL("../../../components/editor/EditorSettingsDialog.vue", import.meta.url), "utf8");
const dataTransferDialogSource = readFileSync(new URL("../../../components/transfer/DataTransferDialog.vue", import.meta.url), "utf8");
const editorToolbarSource = readFileSync(new URL("../../../components/layout/EditorToolbar.vue", import.meta.url), "utf8");
const schemaDiffConfigStepSource = readFileSync(new URL("../../../components/diff/SchemaDiffConfigStep.vue", import.meta.url), "utf8");
const dataCompareDialogSource = readFileSync(new URL("../../../components/diff/DataCompareDialog.vue", import.meta.url), "utf8");
describe("SearchableSelect layout", () => {
it("keeps slotted option labels inside a shrinkable overflow boundary", () => {
const labelBoundaries = searchableSelectSource.match(/dbx-searchable-select-option-label min-w-0 flex-1 overflow-hidden/g) ?? [];
expect(labelBoundaries).toHaveLength(3);
});
it("can preserve custom option whitespace for exact database identifiers", () => {
expect(searchableSelectSource).toContain("trimCustom?: boolean");
expect(searchableSelectSource).toContain("trimCustom: true");
expect(searchableSelectSource).toContain("props.trimCustom ? searchText.value.trim() : searchText.value");
});
it("forwards an optional style to its portaled content for local preview isolation", () => {
expect(searchableSelectSource).toContain('contentStyle?: HTMLAttributes["style"]');
expect(searchableSelectSource).toContain(':style="contentStyle"');
expect(editorSettingsDialogSource).toContain(':content-style="{ fontFamily: editUiFontFamily || DEFAULT_UI_FONT_FAMILY }"');
expect(editorSettingsDialogSource).toContain('@option-hover="previewUiFontOption"');
expect(editorSettingsDialogSource).toContain('@option-highlight="previewUiFontOption"');
expect(editorSettingsDialogSource).toContain('@option-leave="restoreUiFontFamilyPreview"');
});
it("renders data transfer connection pickers as sidebar-like trees", () => {
const treeSelects = dataTransferDialogSource.match(/<ConnectionTreeSelect/g) ?? [];
expect(treeSelects).toHaveLength(2);
expect(dataTransferDialogSource).toContain(':layout="store.sidebarLayout"');
expect(dataTransferDialogSource).not.toContain("ConnectionGroupBadge");
});
it("renders the toolbar connection picker as a sidebar-like tree", () => {
expect(editorToolbarSource).toContain("<ConnectionTreeSelect");
expect(editorToolbarSource).toContain(':connections="connectionStore.connections"');
expect(editorToolbarSource).toContain(':layout="connectionStore.sidebarLayout"');
});
it.each([
["schema compare", schemaDiffConfigStepSource],
["data compare", dataCompareDialogSource],
])("renders %s connection pickers as sidebar-like trees", (_name, source) => {
expect(source.match(/<ConnectionTreeSelect/g) ?? []).toHaveLength(2);
expect(source).toContain(':connections="sqlConnections"');
expect(source).toContain(':layout="store.sidebarLayout"');
expect(source).not.toContain("ConnectionGroupBadge");
});
});