perf(test): consolidate auth/pty/health mini suites

This commit is contained in:
Peter Steinberger
2026-02-16 01:12:21 +00:00
parent f142048293
commit ea07d3fdd8
8 changed files with 74 additions and 75 deletions

View File

@@ -2,7 +2,11 @@ import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { describe, expect, it } from "vitest";
import { ensureAuthProfileStore, markAuthProfileFailure } from "./auth-profiles.js";
import {
calculateAuthProfileCooldownMs,
ensureAuthProfileStore,
markAuthProfileFailure,
} from "./auth-profiles.js";
describe("markAuthProfileFailure", () => {
it("disables billing failures for ~5 hours by default", async () => {
@@ -129,3 +133,13 @@ describe("markAuthProfileFailure", () => {
}
});
});
describe("calculateAuthProfileCooldownMs", () => {
it("applies exponential backoff with a 1h cap", () => {
expect(calculateAuthProfileCooldownMs(1)).toBe(60_000);
expect(calculateAuthProfileCooldownMs(2)).toBe(5 * 60_000);
expect(calculateAuthProfileCooldownMs(3)).toBe(25 * 60_000);
expect(calculateAuthProfileCooldownMs(4)).toBe(60 * 60_000);
expect(calculateAuthProfileCooldownMs(5)).toBe(60 * 60_000);
});
});