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
// @vitest-environment happy-dom
import { describe, expect, it, vi } from "vitest";
import { COMPONENT_DRIVER_UPDATES_CHANGED_EVENT, COMPONENT_PLUGINS_UPDATED_EVENT, COMPONENT_UPDATES_CHANGED_EVENT, notifyComponentDriverUpdatesChanged, notifyComponentPluginsUpdated, notifyComponentUpdatesChanged } from "@/lib/updates/componentUpdateEvents";
describe("component update events", () => {
it("notifies plugin surfaces after component-level plugin updates", () => {
const listener = vi.fn();
window.addEventListener(COMPONENT_PLUGINS_UPDATED_EVENT, listener);
notifyComponentPluginsUpdated();
expect(listener).toHaveBeenCalledOnce();
window.removeEventListener(COMPONENT_PLUGINS_UPDATED_EVENT, listener);
});
it("notifies the app when a management surface changes component state", () => {
const listener = vi.fn();
window.addEventListener(COMPONENT_UPDATES_CHANGED_EVENT, listener);
notifyComponentUpdatesChanged();
expect(listener).toHaveBeenCalledOnce();
window.removeEventListener(COMPONENT_UPDATES_CHANGED_EVENT, listener);
});
it("notifies the driver store when component updates change driver state", () => {
const listener = vi.fn();
window.addEventListener(COMPONENT_DRIVER_UPDATES_CHANGED_EVENT, listener);
notifyComponentDriverUpdatesChanged();
expect(listener).toHaveBeenCalledOnce();
window.removeEventListener(COMPONENT_DRIVER_UPDATES_CHANGED_EVENT, listener);
});
it("is inert when the store runs outside a browser environment", () => {
vi.stubGlobal("window", undefined);
try {
expect(() => notifyComponentPluginsUpdated()).not.toThrow();
expect(() => notifyComponentDriverUpdatesChanged()).not.toThrow();
expect(() => notifyComponentUpdatesChanged()).not.toThrow();
} finally {
vi.unstubAllGlobals();
}
});
});