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 { shouldLoadMoreRedisKeys } from "@/lib/redis/redisKeyInfiniteScroll";
const baseState = {
enabled: true,
hasMore: true,
busy: false,
loadedKeys: 1000,
maxKeys: 5000,
scrollTop: 800,
clientHeight: 200,
scrollHeight: 1050,
};
describe("shouldLoadMoreRedisKeys", () => {
it("loads the next scan page near the bottom", () => {
expect(shouldLoadMoreRedisKeys(baseState)).toBe(true);
});
it("does not load while disabled, busy, or exhausted", () => {
expect(shouldLoadMoreRedisKeys({ ...baseState, enabled: false })).toBe(false);
expect(shouldLoadMoreRedisKeys({ ...baseState, busy: true })).toBe(false);
expect(shouldLoadMoreRedisKeys({ ...baseState, hasMore: false })).toBe(false);
});
it("stops automatic loading at the configured maximum", () => {
expect(shouldLoadMoreRedisKeys({ ...baseState, loadedKeys: 5000 })).toBe(false);
});
it("does not load before reaching the bottom threshold", () => {
expect(shouldLoadMoreRedisKeys({ ...baseState, scrollTop: 700 })).toBe(false);
});
});