mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 08:10:44 +00:00
test: slim status fast-mode label coverage
This commit is contained in:
6
src/status/status-labels.ts
Normal file
6
src/status/status-labels.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export const formatFastModeLabel = (enabled: boolean): string | null => {
|
||||
if (!enabled) {
|
||||
return null;
|
||||
}
|
||||
return "Fast";
|
||||
};
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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") {
|
||||
|
||||
Reference in New Issue
Block a user