test(core): trim duplicate strict-subset assertions (#124090)

This commit is contained in:
Peter Steinberger
2026-08-15 00:52:34 -07:00
committed by GitHub
parent d1f8c339b1
commit 34efe370b2
6 changed files with 2 additions and 42 deletions
-5
View File
@@ -2,7 +2,6 @@
import { describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../config/config.js";
import {
CONTEXT_WINDOW_HARD_MIN_TOKENS,
evaluateContextWindowGuard,
formatContextWindowBlockMessage,
formatContextWindowWarningMessage,
@@ -312,10 +311,6 @@ describe("context-window-guard", () => {
expect(guard.shouldBlock).toBe(false);
});
it("exports the public hard-min floor as expected", () => {
expect(CONTEXT_WINDOW_HARD_MIN_TOKENS).toBe(4_000);
});
it("derives percentage-based guard thresholds above the safe floors", () => {
const largeGuard = evaluateContextWindowGuard({
info: { tokens: 1_000_000, source: "model" },
@@ -511,11 +511,6 @@ describe("calculateMaxToolResultChars", () => {
expect(DEFAULT_MAX_LIVE_TOOL_RESULT_CHARS).toBe(16_000);
});
it("auto-scales above the low-context cap for very large windows", () => {
const result = calculateMaxToolResultChars(2_000_000); // 2M token window
expect(result).toBeGreaterThan(DEFAULT_MAX_LIVE_TOOL_RESULT_CHARS);
});
it("uses a larger auto cap for 128K contexts", () => {
const result = calculateMaxToolResultChars(128_000);
expect(result).toBe(32_000);
-16
View File
@@ -1,6 +1,5 @@
// Log level tests cover allowed levels and level ordering.
import { expectDefined } from "@openclaw/normalization-core";
import { describe, expect, it } from "vitest";
import { levelToMinLevel } from "./levels.js";
@@ -17,19 +16,4 @@ describe("levelToMinLevel", () => {
it("maps silent to Infinity to suppress all logs", () => {
expect(levelToMinLevel("silent")).toBe(Number.POSITIVE_INFINITY);
});
it("fatal has a higher value than trace (not inverted)", () => {
expect(levelToMinLevel("fatal")).toBeGreaterThan(levelToMinLevel("trace"));
});
it("each level is strictly more restrictive than the one below it", () => {
const ordered = ["trace", "debug", "info", "warn", "error", "fatal"] as const;
for (let i = 1; i < ordered.length; i++) {
expect(
levelToMinLevel(expectDefined(ordered[i], "ordered[i] test invariant")),
).toBeGreaterThan(
levelToMinLevel(expectDefined(ordered[i - 1], "ordered[i - 1] test invariant")),
);
}
});
});
-2
View File
@@ -27,8 +27,6 @@ describe("scripts/bench-model", () => {
});
it("rejects unknown args before checking provider credentials", () => {
expect(() => testing.parseArgs(["--wat"])).toThrow("Unknown argument: --wat");
const result = runBenchModel(["--wat"]);
expect(result.status).toBe(1);
@@ -23,8 +23,6 @@ describe("scripts/perf/summarize-cpuprofile.mjs", () => {
});
it("prints help without treating it as a profile path", () => {
expect(shouldPrintHelp(["--help"])).toBe(true);
expect(shouldPrintHelp(["--limit", "-h", "a.cpuprofile"])).toBe(false);
expect(shouldPrintHelp(["--limit", "--", "--help"])).toBe(false);
expect(shouldPrintHelp(["--limit=1e3", "--help"])).toBe(false);
expect(shouldPrintHelp(["--", "--help"])).toBe(false);
@@ -46,7 +44,6 @@ describe("scripts/perf/summarize-cpuprofile.mjs", () => {
it("rejects malformed limit flags instead of falling back", () => {
for (const args of [
["--limit", "3frames", "a.cpuprofile"],
["--limit", "-h", "a.cpuprofile"],
["--limit", "--", "--help"],
["--limit", "0", "a.cpuprofile"],
["--limit=1e3", "a.cpuprofile"],
@@ -70,8 +67,6 @@ describe("scripts/perf/summarize-cpuprofile.mjs", () => {
});
it("rejects unknown options instead of treating them as profile paths", () => {
expect(() => parseArgs(["--wat"])).toThrow("Unknown option: --wat");
const result = spawnSync(process.execPath, ["scripts/perf/summarize-cpuprofile.mjs", "--wat"], {
cwd: process.cwd(),
encoding: "utf8",
+2 -9
View File
@@ -15,13 +15,7 @@ afterEach(async () => {
});
describe("test-shell-completion script", () => {
it("parses explicit shell overrides", () => {
expect(shellCompletionTesting.parseArgs(["--shell", "bash", "--check-only"])).toEqual({
checkOnly: true,
force: false,
help: false,
shell: "bash",
});
it("parses an attached shell override", () => {
expect(shellCompletionTesting.parseArgs(["--shell=fish"])).toEqual({
checkOnly: false,
force: false,
@@ -30,8 +24,7 @@ describe("test-shell-completion script", () => {
});
});
it("rejects unknown or malformed arguments before touching shell state", () => {
expect(() => shellCompletionTesting.parseArgs(["--wat"])).toThrow("Unknown argument: --wat");
it("rejects malformed arguments before touching shell state", () => {
expect(() => shellCompletionTesting.parseArgs(["--shell"])).toThrow("--shell requires a value");
expect(() => shellCompletionTesting.parseArgs(["--shell", "--check-only"])).toThrow(
"--shell requires a value",