test(core): remove dead and duplicate coverage (#116641)

* test(markdown): make code table style coverage assertive

* test(core): remove duplicate regression coverage
This commit is contained in:
Vincent Koc
2026-07-31 11:48:46 +08:00
committed by GitHub
parent 326a4831cc
commit b015925bc3
7 changed files with 15 additions and 143 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ describe("gateway client handshake timeouts", () => {
).toBe(15_000);
});
it("caps connect challenge timeout env and explicit values to the safe timer range", () => {
it("caps gateway connect challenge env and explicit timeouts to the safe timer range", () => {
expect(
getConnectChallengeTimeoutMsFromEnv({
OPENCLAW_CONNECT_CHALLENGE_TIMEOUT_MS: "3000000000",
@@ -47,88 +47,22 @@ describe("markdownToIR tableMode code", () => {
);
});
it("should not have overlapping styles when cell has bold text", () => {
it("strips inner styles from code-mode table cells", () => {
const md = `
| Name | Value |
|------|-------|
| **Bold** | Normal |
| **Bold** | *Italic* |
| \`Code\` | ~~Strike~~ |
`.trim();
const ir = markdownToIR(md, { tableMode: "code" });
// Check for overlapping styles
const codeBlockSpan = ir.styles.find((s) => s.style === "code_block");
const boldSpan = ir.styles.find((s) => s.style === "bold");
// Either:
// 1. There should be no bold spans in code mode (inner styles stripped), OR
// 2. If bold spans exist, they should not overlap with code_block span
if (codeBlockSpan && boldSpan) {
// Check for overlap
const overlaps = boldSpan.start < codeBlockSpan.end && boldSpan.end > codeBlockSpan.start;
// Overlapping styles are the bug - this should fail until fixed
expect(overlaps).toBe(false);
}
});
it("should not have overlapping styles when cell has italic text", () => {
const md = `
| Name | Value |
|------|-------|
| *Italic* | Normal |
`.trim();
const ir = markdownToIR(md, { tableMode: "code" });
const codeBlockSpan = ir.styles.find((s) => s.style === "code_block");
const italicSpan = ir.styles.find((s) => s.style === "italic");
if (codeBlockSpan && italicSpan) {
const overlaps = italicSpan.start < codeBlockSpan.end && italicSpan.end > codeBlockSpan.start;
expect(overlaps).toBe(false);
}
});
it("should not have overlapping styles when cell has inline code", () => {
const md = `
| Name | Value |
|------|-------|
| \`code\` | Normal |
`.trim();
const ir = markdownToIR(md, { tableMode: "code" });
const codeBlockSpan = ir.styles.find((s) => s.style === "code_block");
const codeSpan = ir.styles.find((s) => s.style === "code");
if (codeBlockSpan && codeSpan) {
const overlaps = codeSpan.start < codeBlockSpan.end && codeSpan.end > codeBlockSpan.start;
expect(overlaps).toBe(false);
}
});
it("should not have overlapping styles with multiple styled cells", () => {
const md = `
| Name | Value |
|------|-------|
| **A** | *B* |
| _C_ | ~~D~~ |
`.trim();
const ir = markdownToIR(md, { tableMode: "code" });
const codeBlockSpan = ir.styles.find((s) => s.style === "code_block");
if (!codeBlockSpan) {
return;
}
// Check that no non-code_block style overlaps with code_block
for (const style of ir.styles) {
if (style.style === "code_block") {
continue;
}
const overlaps = style.start < codeBlockSpan.end && style.end > codeBlockSpan.start;
expect(overlaps).toBe(false);
}
expect(ir.styles).toEqual([
{
start: 0,
end: ir.text.trimEnd().length + 1,
style: "code_block",
},
]);
});
});
+1 -12
View File
@@ -2813,7 +2813,7 @@ describe("launchd install", () => {
expect(launchctlCommandNames()).not.toContain("bootout");
});
it("surfaces the original kickstart failure when the service is still loaded", async () => {
it("surfaces kickstart failure without re-bootstrap when the service stays loaded (#52208)", async () => {
const env = createDefaultLaunchdEnv();
state.kickstartError = "Input/output error";
state.kickstartFailuresRemaining = 1;
@@ -2836,17 +2836,6 @@ describe("launchd install", () => {
expect(launchctlCommandNames()).toContain("bootstrap");
});
it("skips re-bootstrap when kickstart fails but service is still loaded (#52208)", async () => {
const env = createDefaultLaunchdEnv();
state.kickstartError = "Input/output error";
state.kickstartFailuresRemaining = 1;
await expectRestartLaunchAgentKickstartFailure(env);
expect(launchctlCommandNames()).toContain("enable");
expect(launchctlCommandNames()).not.toContain("bootstrap");
});
it("hands restart off to a detached helper when invoked from the current LaunchAgent", async () => {
const env = createDefaultLaunchdEnv();
-19
View File
@@ -146,25 +146,6 @@ describe("gateway handshake timeouts", () => {
).toBeUndefined();
});
test("caps connect challenge timeout env and explicit values to the safe timer range", () => {
expect(
getConnectChallengeTimeoutMsFromEnv({
OPENCLAW_CONNECT_CHALLENGE_TIMEOUT_MS: "3000000000",
}),
).toBe(MAX_SAFE_TIMEOUT_DELAY_MS);
expect(
resolveConnectChallengeTimeoutMs(3_000_000_000, {
env: {},
configuredTimeoutMs: 3_000_000_000,
}),
).toBe(MAX_SAFE_TIMEOUT_DELAY_MS);
expect(
resolveConnectChallengeTimeoutMs(undefined, {
env: { OPENCLAW_CONNECT_CHALLENGE_TIMEOUT_MS: "3000000000" },
}),
).toBe(MAX_SAFE_TIMEOUT_DELAY_MS);
});
test("resolveConnectChallengeTimeoutMs falls back to env override", () => {
const original = process.env.OPENCLAW_CONNECT_CHALLENGE_TIMEOUT_MS;
const originalHandshake = process.env.OPENCLAW_HANDSHAKE_TIMEOUT_MS;
+1 -18
View File
@@ -410,7 +410,7 @@ describe("operator approval store", () => {
expect(record).toMatchObject({ status: "expired", terminalReason: "timeout" });
});
it("preserves protocol-valid boundary whitespace as opaque approval identity", () => {
it("preserves BOM, NBSP, and boundary spaces as opaque approval identity", () => {
const databaseOptions = createDatabaseOptions();
for (const [index, id] of ["\uFEFF", "\u00A0", " approval-edge "].entries()) {
const inserted = insertOperatorApproval({
@@ -462,23 +462,6 @@ describe("operator approval store", () => {
}
});
it("preserves protocol-valid boundary whitespace as opaque approval identity", () => {
const databaseOptions = createDatabaseOptions();
for (const [index, id] of ["\uFEFF", "\u00A0", " approval-edge "].entries()) {
const inserted = insertOperatorApproval({
approval: approval(id, { createdAtMs: 1_000 + index }),
databaseOptions,
});
expect(inserted).toMatchObject({ outcome: "inserted", record: { id } });
expect(getOperatorApproval({ id, nowMs: 2_000, databaseOptions })).toMatchObject({
id,
status: "pending",
});
}
expect(getOperatorApproval({ id: "approval-edge", nowMs: 2_000, databaseOptions })).toBeNull();
});
it("keeps canonical ids and transport references in disjoint lookup namespaces", () => {
const databaseOptions = createDatabaseOptions();
const inserted = insertOperatorApproval({
+1 -12
View File
@@ -98,18 +98,7 @@ describe("system-presence version fallback", () => {
);
});
it("still prefers runtime VERSION over npm_package_version when service markers are blank", async () => {
await expectSelfVersion(
{
OPENCLAW_VERSION: " ",
OPENCLAW_SERVICE_VERSION: "\t",
npm_package_version: "1.0.0-package",
},
runtimeVersion,
);
});
it("uses runtime VERSION when OPENCLAW_VERSION and OPENCLAW_SERVICE_VERSION are blank", async () => {
it("uses runtime VERSION when service markers are blank despite npm_package_version", async () => {
await expectSelfVersion(
{
OPENCLAW_VERSION: " ",
+1 -5
View File
@@ -554,7 +554,7 @@ describe("plugin status reports", () => {
expectPluginLoaderCall({ loadModules: true });
});
it("preserves raw config activation context when compatibility notices build their own report", () => {
it("preserves raw config activation context for compatibility-derived reports", () => {
expectAutoEnabledDemoCompatibilityNoticesPreserveRawConfig();
});
@@ -574,10 +574,6 @@ describe("plugin status reports", () => {
});
});
it("preserves raw config activation context for compatibility-derived reports", () => {
expectAutoEnabledDemoCompatibilityNoticesPreserveRawConfig();
});
it("normalizes bundled plugin versions to the core base release", () => {
setSinglePluginLoadResult(
createPluginRecord({