heartbeat-runner.cost-cap.test.ts を更新

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This commit is contained in:
Keita A. 2026-03-19 18:20:49 +09:00 committed by GitHub
parent c2c261798d
commit bd8497f8dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -327,10 +327,11 @@ describe("runHeartbeatOnce maxCostPerRun", () => {
expect(replyCallCount).toBe(1);
});
it("proceeds for free catalog model when maxCostPerRun is 0", async () => {
// Free model: estimated cost = $0. maxCostPerRun = 0. 0 > 0 = false, so run proceeds.
// This uses heartbeat.model override which goes through the hardcoded table,
// not the catalog. A truly free model via catalog would also return $0.
it("skips cheap (non-free) model when maxCostPerRun is 0", async () => {
// gemini-2.0-flash costs $0.10/M input — non-zero — so with maxCostPerRun = 0
// the condition (estimatedCost > 0) is true and the run is skipped.
// Note: a *truly* free model (cost.input = 0 in catalog) would NOT be skipped
// because 0 > 0 === false. That scenario is covered by the unit tests above.
const { result, replyCallCount } = await runWithCostCap({
maxCostPerRun: 0,
model: "gemini-2.0-flash", // cheapest in table, but still > $0 for non-empty prompt