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。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
import { describe, expect, it } from "vitest";
import { capabilityVisible, capabilityWritable, requireConfirmation, scopeHasWildcard } from "@/lib/consul/consulPolicy";
import { nextWatchIndex } from "@/lib/consul/watchState";
describe("Consul domain policies", () => {
it("keeps forbidden separate from unsupported", () => {
expect(capabilityVisible("forbidden")).toBe(true);
expect(capabilityVisible("unsupported")).toBe(false);
expect(capabilityWritable("supported", false)).toBe(true);
expect(capabilityWritable("supported", true)).toBe(false);
});
it("requires explicit wildcard scope and exact confirmations", () => {
expect(scopeHasWildcard({ datacenter: "dc1", namespace: "*", partition: "default" })).toBe(true);
expect(scopeHasWildcard({ datacenter: "dc1", namespace: "team", partition: "default" })).toBe(false);
expect(requireConfirmation("DELETE team", "DELETE team")).toBe(true);
expect(requireConfirmation("DELETE team", "delete team")).toBe(false);
});
it("resets blocking indexes after zero or rollback", () => {
expect(nextWatchIndex("50", "0")).toEqual({ index: "1", reset: true });
expect(nextWatchIndex("50", "49")).toEqual({ index: "1", reset: true });
expect(nextWatchIndex("50", "51")).toEqual({ index: "51", reset: false });
});
});