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。

952 B
Raw Blame
import { describe, expect, it } from "vitest";
import { hasGbase8cConnectionDatabase } from "@/lib/connection/gbase8cDatabase";

describe("hasGbase8cConnectionDatabase", () => {
  it("accepts a filled database name, trimming it", () => {
    expect(hasGbase8cConnectionDatabase("  dbx_pg  ", undefined)).toBe(true);
  });

  it("rejects a missing or blank database", () => {
    expect(hasGbase8cConnectionDatabase(undefined, undefined)).toBe(false);
    expect(hasGbase8cConnectionDatabase("", undefined)).toBe(false);
    expect(hasGbase8cConnectionDatabase("  \t ", undefined)).toBe(false);
  });

  it("accepts a full connection string, which the agent prefers over host/port/database", () => {
    expect(hasGbase8cConnectionDatabase(undefined, "jdbc:gbase8c://db.example:5432/warehouse")).toBe(true);
  });

  it("still rejects a blank connection string", () => {
    expect(hasGbase8cConnectionDatabase(undefined, "   ")).toBe(false);
  });
});