mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 23:02:55 +00:00
refactor(auth): share remaining-time formatter
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { buildAuthHealthSummary, DEFAULT_OAUTH_WARN_MS } from "./auth-health.js";
|
||||
import {
|
||||
buildAuthHealthSummary,
|
||||
DEFAULT_OAUTH_WARN_MS,
|
||||
formatRemainingShort,
|
||||
} from "./auth-health.js";
|
||||
|
||||
describe("buildAuthHealthSummary", () => {
|
||||
const now = 1_700_000_000_000;
|
||||
@@ -87,3 +91,10 @@ describe("buildAuthHealthSummary", () => {
|
||||
expect(statuses["google:no-refresh"]).toBe("expired");
|
||||
});
|
||||
});
|
||||
|
||||
describe("formatRemainingShort", () => {
|
||||
it("supports an explicit under-minute label override", () => {
|
||||
expect(formatRemainingShort(20_000)).toBe("1m");
|
||||
expect(formatRemainingShort(20_000, { underMinuteLabel: "soon" })).toBe("soon");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user