mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-13 10:12:52 +00:00
fix(test): reject malformed boundary check env
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
parseShardSelection,
|
||||
parseShardSpec,
|
||||
resolveConcurrency,
|
||||
resolvePositiveInteger,
|
||||
runChecks,
|
||||
runSingleCheck,
|
||||
selectChecksForShard,
|
||||
@@ -35,8 +36,24 @@ describe("run-additional-boundary-checks", () => {
|
||||
|
||||
it("normalizes concurrency input", () => {
|
||||
expect(resolveConcurrency("6")).toBe(6);
|
||||
expect(resolveConcurrency("0")).toBe(4);
|
||||
expect(resolveConcurrency("nope", 2)).toBe(2);
|
||||
expect(resolveConcurrency(undefined, 2)).toBe(2);
|
||||
expect(() => resolveConcurrency("0")).toThrow("concurrency must be a positive integer; got: 0");
|
||||
expect(() => resolveConcurrency("6x", 2)).toThrow(
|
||||
"concurrency must be a positive integer; got: 6x",
|
||||
);
|
||||
});
|
||||
|
||||
it("rejects malformed timeout and output limit integers", () => {
|
||||
expect(resolvePositiveInteger("25", 50, "OPENCLAW_ADDITIONAL_BOUNDARY_TIMEOUT_MS")).toBe(25);
|
||||
expect(resolvePositiveInteger(undefined, 50, "OPENCLAW_ADDITIONAL_BOUNDARY_TIMEOUT_MS")).toBe(
|
||||
50,
|
||||
);
|
||||
expect(() =>
|
||||
resolvePositiveInteger("1000ms", 50, "OPENCLAW_ADDITIONAL_BOUNDARY_TIMEOUT_MS"),
|
||||
).toThrow("OPENCLAW_ADDITIONAL_BOUNDARY_TIMEOUT_MS must be a positive integer; got: 1000ms");
|
||||
expect(() =>
|
||||
resolvePositiveInteger("1e3", 50, "OPENCLAW_ADDITIONAL_BOUNDARY_OUTPUT_MAX_BYTES"),
|
||||
).toThrow("OPENCLAW_ADDITIONAL_BOUNDARY_OUTPUT_MAX_BYTES must be a positive integer; got: 1e3");
|
||||
});
|
||||
|
||||
it("formats command display text", () => {
|
||||
|
||||
Reference in New Issue
Block a user