test: slim status fast-mode label coverage

This commit is contained in:
Peter Steinberger
2026-04-23 18:49:19 +01:00
parent 310b1eea4a
commit 62a0cd8acd
3 changed files with 11 additions and 28 deletions

View File

@@ -0,0 +1,6 @@
export const formatFastModeLabel = (enabled: boolean): string | null => {
if (!enabled) {
return null;
}
return "Fast";
};

View File

@@ -1,29 +1,12 @@
import { describe, expect, it } from "vitest";
import { normalizeTestText } from "../../test/helpers/normalize-text.js";
import { buildStatusMessage } from "./status-message.js";
import { formatFastModeLabel } from "./status-labels.js";
const buildFastStatus = (model: string, fastMode: boolean) =>
normalizeTestText(
buildStatusMessage({
modelAuth: "api-key",
activeModelAuth: "api-key",
agent: { model },
sessionEntry: {
sessionId: "fast-status",
updatedAt: 0,
fastMode,
},
sessionKey: "agent:main:main",
queue: { mode: "collect", depth: 0 },
}),
);
describe("buildStatusMessage fast mode labels", () => {
describe("formatFastModeLabel", () => {
it("shows fast mode when enabled", () => {
expect(buildFastStatus("openai/gpt-5.4", true)).toContain("Fast");
expect(formatFastModeLabel(true)).toBe("Fast");
});
it("hides fast mode when disabled", () => {
expect(buildFastStatus("anthropic/claude-opus-4-6", false)).not.toContain("Fast");
expect(formatFastModeLabel(false)).toBeNull();
});
});

View File

@@ -56,6 +56,7 @@ import {
} from "../utils/usage-format.js";
import { VERSION } from "../version.js";
import { resolveActiveFallbackState } from "./fallback-notice-state.js";
import { formatFastModeLabel } from "./status-labels.js";
type AgentDefaults = NonNullable<NonNullable<OpenClawConfig["agents"]>["defaults"]>;
type AgentConfig = Partial<AgentDefaults> & {
@@ -263,13 +264,6 @@ const formatQueueDetails = (queue?: QueueStatus) => {
return detailParts.length ? ` (${detailParts.join(" · ")})` : "";
};
const formatFastModeLabel = (enabled: boolean) => {
if (!enabled) {
return null;
}
return "Fast";
};
const formatHarnessLabel = (harnessId: string | undefined) => {
const normalized = normalizeOptionalLowercaseString(harnessId);
if (!normalized || normalized === "pi" || normalized === "auto") {