refactor: remove checkRateLimit and incrementApiCall completely

This commit is contained in:
2026-03-29 23:38:54 +02:00
parent 2365a95f98
commit 5f47feaf32
12 changed files with 75 additions and 163 deletions
+2 -17
View File
@@ -1,11 +1,6 @@
import "fake-indexeddb/auto";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { GeminiConfig } from "./config";
import {
checkRateLimit,
generateImage,
generateText,
} from "./gemini";
import { generateImage, generateText } from "./gemini";
const TEST_CONFIG: GeminiConfig = {
geminiApiKey: "test-api-key",
@@ -13,8 +8,6 @@ const TEST_CONFIG: GeminiConfig = {
imageModel: "gemini-3.1-flash-preview-image",
};
let testCounter = 0;
function makeGeminiTextResponse(text: string) {
return {
candidates: [
@@ -206,12 +199,4 @@ describe("generateImage", () => {
const result = await generateImage("a tree", [], TEST_CONFIG);
expect(result).toBeNull();
});
});
describe("Rate limiting (disabled)", () => {
it("checkRateLimit always returns true (no limits)", async () => {
const db = {} as IDBDatabase;
expect(await checkRateLimit(db, "text")).toBe(true);
expect(await checkRateLimit(db, "image")).toBe(true);
});
});
});
-15
View File
@@ -112,18 +112,3 @@ export async function generateImage(
return null;
}
}
export async function checkRateLimit(
_db: IDBDatabase,
_type: "text" | "image",
): Promise<boolean> {
return true;
}
export async function incrementApiCall(
_db: IDBDatabase,
_type: "text" | "image",
): Promise<void> {
// No-op: rate limits removed
}