refactor(desktop): organize lib modules by domain

This commit is contained in:
t8y2 committed 2026-07-04 13:53:52 +08:00
1 parent 90f0594e93
commit 7e7c4944e9
700 files changed
+1292 -1264

No files matched your search

@@ -0,0 +1,19 @@
import { describe, expect, it } from "vitest";
import { decodeSelectableDatabaseValue, EMPTY_DATABASE_SELECT_VALUE, encodeSelectableDatabaseValue, TREE_SCHEMA_DEFAULT_DATABASE_SELECT_VALUE } from "@/lib/database/defaultDatabase";
describe("defaultDatabase selectable values", () => {
it("encodes empty tree-schema databases with the default database sentinel", () => {
expect(encodeSelectableDatabaseValue("postgres", "")).toBe(TREE_SCHEMA_DEFAULT_DATABASE_SELECT_VALUE);
expect(decodeSelectableDatabaseValue("postgres", TREE_SCHEMA_DEFAULT_DATABASE_SELECT_VALUE)).toBe("");
});
it("encodes empty non-tree-schema databases with a non-empty sentinel", () => {
expect(encodeSelectableDatabaseValue("access", "")).toBe(EMPTY_DATABASE_SELECT_VALUE);
expect(decodeSelectableDatabaseValue("access", EMPTY_DATABASE_SELECT_VALUE)).toBe("");
});
it("preserves non-empty database names", () => {
expect(encodeSelectableDatabaseValue("access", "653128SXB.mdb")).toBe("653128SXB.mdb");
expect(decodeSelectableDatabaseValue("access", "653128SXB.mdb")).toBe("653128SXB.mdb");
});
});