test: dedupe redundant test coverage

This commit is contained in:
Peter Steinberger
2026-05-30 06:27:01 +01:00
parent 9090f6b1c4
commit fcdc25ba64
19 changed files with 248 additions and 514 deletions

View File

@@ -167,21 +167,15 @@ describe("ensure-cli-startup-build", () => {
});
describe("resolveCliStartupBuildTimeoutMs", () => {
it("uses a positive environment timeout", () => {
expect(resolveCliStartupBuildTimeoutMs({ OPENCLAW_CLI_STARTUP_BUILD_TIMEOUT_MS: "4321" })).toBe(
4321,
);
});
it("falls back when the environment timeout is invalid", () => {
expect(resolveCliStartupBuildTimeoutMs({ OPENCLAW_CLI_STARTUP_BUILD_TIMEOUT_MS: "nope" })).toBe(
10 * 60 * 1000,
);
});
it("falls back when the environment timeout has a numeric prefix", () => {
expect(resolveCliStartupBuildTimeoutMs({ OPENCLAW_CLI_STARTUP_BUILD_TIMEOUT_MS: "10m" })).toBe(
10 * 60 * 1000,
);
it("parses only positive integer environment timeouts", () => {
for (const [raw, expected] of [
["4321", 4321],
["nope", 10 * 60 * 1000],
["10m", 10 * 60 * 1000],
] as const) {
expect(resolveCliStartupBuildTimeoutMs({ OPENCLAW_CLI_STARTUP_BUILD_TIMEOUT_MS: raw })).toBe(
expected,
);
}
});
});

View File

@@ -144,27 +144,17 @@ describe("ensure-extension-memory-build", () => {
});
describe("resolveExtensionMemoryBuildTimeoutMs", () => {
it("uses a positive environment timeout", () => {
expect(
resolveExtensionMemoryBuildTimeoutMs({
OPENCLAW_EXTENSION_MEMORY_BUILD_TIMEOUT_MS: "4321",
}),
).toBe(4321);
});
it("falls back when the environment timeout is invalid", () => {
expect(
resolveExtensionMemoryBuildTimeoutMs({
OPENCLAW_EXTENSION_MEMORY_BUILD_TIMEOUT_MS: "nope",
}),
).toBe(10 * 60 * 1000);
});
it("falls back when the environment timeout has a numeric prefix", () => {
expect(
resolveExtensionMemoryBuildTimeoutMs({
OPENCLAW_EXTENSION_MEMORY_BUILD_TIMEOUT_MS: "10m",
}),
).toBe(10 * 60 * 1000);
it("parses only positive integer environment timeouts", () => {
for (const [raw, expected] of [
["4321", 4321],
["nope", 10 * 60 * 1000],
["10m", 10 * 60 * 1000],
] as const) {
expect(
resolveExtensionMemoryBuildTimeoutMs({
OPENCLAW_EXTENSION_MEMORY_BUILD_TIMEOUT_MS: raw,
}),
).toBe(expected);
}
});
});