17 lines
770 B
JavaScript
17 lines
770 B
JavaScript
|
|
import { describe, expect, it } from "vitest";
|
||
|
|
import { applyErrorState, resetAccountState } from "../../open-sse/services/accountFallback.js";
|
||
|
|
|
||
|
|
describe("resetAccountState", () => {
|
||
|
|
it("clears every model lock and backoff after success", () => {
|
||
|
|
const reset = resetAccountState({ backoffLevel: 9, modelLock_alpha: "2099-01-01T00:00:00.000Z", modelLock___all: "2099-01-01T00:00:00.000Z", lastError: "429", errorCode: 429 });
|
||
|
|
expect(reset.backoffLevel).toBe(0);
|
||
|
|
expect(reset.modelLock_alpha).toBeNull();
|
||
|
|
expect(reset.modelLock___all).toBeNull();
|
||
|
|
expect(reset.lastError).toBeNull();
|
||
|
|
});
|
||
|
|
|
||
|
|
it("keeps 429 on error path ratcheting upward", () => {
|
||
|
|
expect(applyErrorState({ backoffLevel: 3 }, 429, "rate limited").backoffLevel).toBe(4);
|
||
|
|
});
|
||
|
|
});
|