mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-31 20:01:36 +00:00
25 lines
649 B
TypeScript
25 lines
649 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { clampRuntimeAuthRefreshDelayMs } from "./runtime-auth-refresh.js";
|
|
|
|
describe("clampRuntimeAuthRefreshDelayMs", () => {
|
|
it("clamps far-future refresh delays to a timer-safe ceiling", () => {
|
|
expect(
|
|
clampRuntimeAuthRefreshDelayMs({
|
|
refreshAt: 12_345_678_901_000,
|
|
now: 0,
|
|
minDelayMs: 60_000,
|
|
}),
|
|
).toBe(2_147_483_647);
|
|
});
|
|
|
|
it("still respects the configured minimum delay", () => {
|
|
expect(
|
|
clampRuntimeAuthRefreshDelayMs({
|
|
refreshAt: 1_000,
|
|
now: 900,
|
|
minDelayMs: 60_000,
|
|
}),
|
|
).toBe(60_000);
|
|
});
|
|
});
|