Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
import { describe, it } from "node:test";
import assert from "node:assert/strict";
const mod = await import("../../src/lib/db/cleanup.ts");
describe("cleanup DB module", () => {
it("cleanupQuotaSnapshots returns result with deleted count", async () => {
const result = await mod.cleanupQuotaSnapshots();
assert.ok(typeof result.deleted === "number", "should have deleted count");
assert.ok(typeof result.errors === "number", "should have errors count");
});
it("cleanupUsageHistory returns result", async () => {
const result = await mod.cleanupUsageHistory();
assert.ok(typeof result.deleted === "number");
assert.ok(typeof result.errors === "number");
});
it("purgeDetailedLogs returns result", async () => {
const result = await mod.purgeDetailedLogs();
assert.ok(typeof result.deleted === "number");
assert.ok(typeof result.errors === "number");
});
it("runAutoCleanup returns summary with totalDeleted and totalErrors", async () => {
const result = await mod.runAutoCleanup();
assert.ok(typeof result.totalDeleted === "number", "should have totalDeleted");
assert.ok(typeof result.totalErrors === "number", "should have totalErrors");
assert.ok(typeof result.results === "object", "should have results");
});
it("cleanupCallLogs returns result (may error if table missing)", async () => {
const result = await mod.cleanupCallLogs();
assert.ok(typeof result.deleted === "number");
assert.ok(typeof result.errors === "number");
});
it("cleanupMcpAudit returns result (may error if table missing)", async () => {
const result = await mod.cleanupMcpAudit();
assert.ok(typeof result.deleted === "number");
assert.ok(typeof result.errors === "number");
});
it("cleanupA2aEvents returns result (may error if table missing)", async () => {
const result = await mod.cleanupA2aEvents();
assert.ok(typeof result.deleted === "number");
assert.ok(typeof result.errors === "number");
});
});