Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions test/e2e/live/openclaw-inference-switch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,10 @@ async function openclawGatewayPid(sandbox: SandboxClient, home: string): Promise
return result.stdout.trim();
}

function escapeRegExp(value: string): string {
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}

async function getRouteOutput(host: HostCliClient, home: string): Promise<ShellProbeResult> {
return runNemoclaw(host, home, ["inference", "get"], {
artifactName: "nemoclaw-inference-get-after-switch",
Expand Down Expand Up @@ -1315,8 +1319,13 @@ test(
const route = await getRouteOutput(host, home);
expect(route.exitCode, resultText(route)).toBe(0);
const plainRoute = stripAnsi(resultText(route));
expect(plainRoute).toContain(`Provider: ${SWITCH_PROVIDER}`);
expect(plainRoute).toContain(`Model: ${SWITCH_MODEL}`);
// The CLI aligns the label columns; the exact rendering contract is owned by
// src/lib/actions/inference-get.test.ts, so accept one or more spaces here and
// require each displayed value to end at the line boundary.
expect(plainRoute).toMatch(
new RegExp(`Provider: +${escapeRegExp(SWITCH_PROVIDER)}(?:\\r?\\n|$)`),
);
expect(plainRoute).toMatch(new RegExp(`Model: +${escapeRegExp(SWITCH_MODEL)}(?:\\r?\\n|$)`));
await assertOpenClawConfig(sandbox, home, {
model: SWITCH_MODEL,
inferenceApi: SWITCH_INFERENCE_API,
Expand Down