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。

1.3 KB
Raw Blame
import { describe, expect, it } from "vitest";
import { gbaseProfileFromConfig, isGbaseProfile } from "@/lib/connection/gbaseProfiles";

describe("gbaseProfiles", () => {
  it("recognizes the three GBase toggle profiles", () => {
    expect(["gbase8a", "gbase8s", "gbase8c"].every(isGbaseProfile)).toBe(true);
    expect(isGbaseProfile("gbase")).toBe(false);
    expect(isGbaseProfile(undefined)).toBe(false);
  });

  it("resolves the toggle profile from a saved connection", () => {
    expect(gbaseProfileFromConfig({ db_type: "gbase8c", driver_profile: "gbase8c" })).toBe("gbase8c");
    expect(gbaseProfileFromConfig({ db_type: "gbase8c" })).toBe("gbase8c");
    expect(gbaseProfileFromConfig({ db_type: "gbase8s", driver_profile: "gbase8s" })).toBe("gbase8s");
    expect(gbaseProfileFromConfig({ db_type: "gbase8s" })).toBe("gbase8s");
    // A not-yet-migrated in-memory config still resolves to the 8s toggle.
    expect(gbaseProfileFromConfig({ db_type: "gbase", driver_profile: "gbase8s" })).toBe("gbase8s");
    expect(gbaseProfileFromConfig({ db_type: "gbase", driver_profile: "gbase8a" })).toBe("gbase8a");
    expect(gbaseProfileFromConfig({ db_type: "gbase", driver_profile: "gbase" })).toBe("gbase8a");
    expect(gbaseProfileFromConfig({ db_type: "gbase" })).toBe("gbase8a");
  });
});