fix(export): allow routine-only database exports

Closes #6888
This commit is contained in:
t8y2 committed 2026-08-23 22:00:42 +08:00
1 parent e15ade130d
commit b4b04d30b8
3 files changed
+58 -3

No files matched your search

+34
View File
@@ -1,6 +1,40 @@
import assert from "node:assert/strict";
import { test } from "vitest";
import { buildAllDatabaseExportPlan } from "../../apps/desktop/src/lib/export/databaseExport.ts";
import { isDatabaseExportTableSelectionValid } from "../../apps/desktop/src/lib/export/databaseExportSelection.ts";
test("database export allows object-only exports without selecting tables", () => {
assert.equal(
isDatabaseExportTableSelectionValid({
allTableCount: 982,
selectedTableCount: 0,
includeStructure: false,
includeData: false,
}),
true,
);
});
test("database export still requires a table when exporting structure or data", () => {
assert.equal(
isDatabaseExportTableSelectionValid({
allTableCount: 982,
selectedTableCount: 0,
includeStructure: true,
includeData: false,
}),
false,
);
assert.equal(
isDatabaseExportTableSelectionValid({
allTableCount: 982,
selectedTableCount: 1,
includeStructure: false,
includeData: true,
}),
true,
);
});
test("all-database export includes every schema for schema-aware databases", () => {
const plan = buildAllDatabaseExportPlan({