openclaw/test/scripts/issue-78851-model-resolution.test.ts
Peter Steinberger c757675f34
improve: keep isolated tests under one second (#100019)
* test: speed up isolated test suite

* test: finish isolated latency cleanup

* test: eliminate remaining isolated latency spikes

* test: remove final isolated timing outliers

* test: bound full-suite tooling processes

* test: bound native test process lifetime

* test: warm isolated runtime suites

* test: eliminate final isolated timing outliers

* test: fix isolated timing fixture types

* test: make timeout cleanup timing deterministic

* test: pin media manifests to source checkout

* test: isolate provider manifest contracts

* test: eliminate residual isolated timing spikes

* test: restore final isolated timing fixes

* test: eliminate remaining isolated timing spikes

* test: warm Zalo lifecycle imports

* test: keep isolated suites below one second

* test: use readable browser response fixtures
2026-07-05 10:57:19 -07:00

49 lines
1.8 KiB
TypeScript

// Issue 78851 profiler CLI tests cover argument handling before work starts.
import { describe, expect, it } from "vitest";
import {
issue78851ModelResolutionHelpRequested,
issue78851ModelResolutionUsage,
parseIssue78851ModelResolutionOptions,
} from "../../scripts/perf/issue-78851-model-resolution-cli.js";
describe("issue 78851 model resolution profiler CLI", () => {
it("prints help without starting the profiler", () => {
const usage = issue78851ModelResolutionUsage();
expect(issue78851ModelResolutionHelpRequested(["--help"])).toBe(true);
expect(usage).toContain("OpenClaw issue #78851 model-resolution profiler");
expect(usage).toContain(
"node --import tsx scripts/perf/issue-78851-model-resolution.ts [options]",
);
});
it("rejects unknown arguments before starting the profiler", () => {
expect(() => parseIssue78851ModelResolutionOptions(["--wat"])).toThrow(
"Unknown argument: --wat",
);
});
it("rejects partial numeric arguments before starting the profiler", () => {
expect(() => parseIssue78851ModelResolutionOptions(["--providers", "48junk"])).toThrow(
"--providers must be a positive integer",
);
});
it("rejects short flag values before starting the profiler", () => {
expect(() => parseIssue78851ModelResolutionOptions(["--providers", "-h"])).toThrow(
"--providers requires a value",
);
});
it("rejects invalid arguments even when help is also requested", () => {
expect(() => parseIssue78851ModelResolutionOptions(["--wat", "--help"])).toThrow(
"Unknown argument: --wat",
);
});
it("rejects duplicate value flags before starting the profiler", () => {
expect(() =>
parseIssue78851ModelResolutionOptions(["--providers", "48", "--providers", "96"]),
).toThrow("--providers was provided more than once");
});
});