mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
44 lines
1.0 KiB
JavaScript
44 lines
1.0 KiB
JavaScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
const usageService = await import("./open-sse/services/usage.ts");
|
|
|
|
test("antigravity fraction logic", async () => {
|
|
const originalFetch = globalThis.fetch;
|
|
globalThis.fetch = async (url) => {
|
|
if (url.includes("loadCodeAssist")) {
|
|
return new Response(
|
|
JSON.stringify({
|
|
currentTier: { id: "pro", name: "Pro" },
|
|
}),
|
|
{ status: 200 }
|
|
);
|
|
}
|
|
if (url.includes("fetchAvailableModels")) {
|
|
return new Response(
|
|
JSON.stringify({
|
|
models: {
|
|
"gemini-1.5-pro": {
|
|
quotaInfo: {
|
|
remainingFraction: 0,
|
|
resetTime: "2025-05-01T00:00:00Z",
|
|
},
|
|
},
|
|
},
|
|
}),
|
|
{ status: 200 }
|
|
);
|
|
}
|
|
};
|
|
|
|
try {
|
|
const res = await usageService.getUsageForProvider({
|
|
provider: "antigravity",
|
|
accessToken: "test",
|
|
});
|
|
console.log(JSON.stringify(res, null, 2));
|
|
} finally {
|
|
globalThis.fetch = originalFetch;
|
|
}
|
|
});
|