From a1b7d40bb0212cdfdddd770a1bccbed097601e0a Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Fri, 9 Oct 2026 02:33:01 +0800 Subject: [PATCH] test: remove duplicate result assertions before throwing guards --- src/application/binary/AnalysisProviderRegistry.test.ts | 3 --- src/application/binary/AnalysisSnapshotCache.test.ts | 1 - .../javascript/JavaScriptApplicationCancellation.test.ts | 2 -- .../javascript/JavaScriptApplicationService.test.ts | 5 ----- src/application/javascript/JavaScriptFileUrlPaths.test.ts | 1 - .../javascript/JavaScriptModuleSpecifierPaths.test.ts | 2 -- src/application/javascript/JavaScriptRecoveryService.test.ts | 1 - src/browser/PlaywrightBrowserScenarioProvider.test.ts | 1 - src/config.test.ts | 2 -- src/domain/safeJson.test.ts | 1 - src/ghidra/GhidraFunctionValues.test.ts | 2 -- src/ghidra/GhidraProvider.behavior.test.ts | 1 - src/ida/IdaSessionClient.test.ts | 2 -- src/process/capture/ProcessHarness.test.ts | 1 - src/server/toolResultEncoding.test.ts | 1 - tests/boundary/android/jadxIntegration.test.ts | 1 - .../browser/cdpBrowserProvider.targetInventory.test.ts | 1 - .../browser/cdpBrowserProvider.timelineEvents.test.ts | 1 - tests/boundary/browser/cdpWebRuntime.test.ts | 2 -- tests/boundary/filesystem/binaryTarget.test.ts | 2 -- tests/boundary/filesystem/referenceSourceImport.test.ts | 1 - tests/boundary/filesystem/webScriptExport.test.ts | 5 ----- .../inspector/javascriptRuntimeUnresolvedTarget.test.ts | 2 -- tests/boundary/javascript-recovery/wakaruIntegration.test.ts | 3 --- ...enhancedTools.03-returns-typed-graph-failures-and.test.ts | 1 - tests/boundary/process/processCaptureLifecycle.test.ts | 5 ----- tests/boundary/providers/managed/managedArmMachine.test.ts | 2 -- .../providers/native/nativeSignatureTargetBinding.test.ts | 4 ---- tests/boundary/providers/native/nativeTextRobustness.test.ts | 1 - tests/composition/analysis-sessions/appleApplication.test.ts | 1 - .../analysis-sessions/managedApplicationGraph.test.ts | 1 - tests/composition/idaProvider.test.ts | 2 -- tests/conformance/contracts/mcpResponseBudget.test.ts | 1 - 33 files changed, 62 deletions(-) diff --git a/src/application/binary/AnalysisProviderRegistry.test.ts b/src/application/binary/AnalysisProviderRegistry.test.ts index 8c0b2ed4e..5423044d8 100644 --- a/src/application/binary/AnalysisProviderRegistry.test.ts +++ b/src/application/binary/AnalysisProviderRegistry.test.ts @@ -139,7 +139,6 @@ describe("analysis provider registry: binding failures and cancellation", () => const unsupported = await new AnalysisProviderRegistry([ candidate("alpha", { available: false }).provider, ]).select(ARTIFACT_TARGET, "alpha"); - expect(unsupported.ok).toBe(false); if (unsupported.ok) throw new Error("expected unsupported target rejection"); expect(unsupported.error).toBeInstanceOf(ProviderSelectionError); @@ -181,7 +180,6 @@ describe("analysis provider registry: binding failures and cancellation", () => }); } const explicit = await automatic.select(ARTIFACT_TARGET, "alpha"); - expect(explicit.ok).toBe(false); if (explicit.ok) throw new Error("expected provider selection rejection"); expect(explicit.error).toBeInstanceOf(ProviderSelectionError); if (explicit.error instanceof ProviderSelectionError) @@ -213,7 +211,6 @@ describe("analysis provider registry: binding failures and cancellation", () => const explicit = await new AnalysisProviderRegistry([ failed.provider, ]).select(DATABASE_TARGET, "failed"); - expect(explicit.ok).toBe(false); if (explicit.ok) throw new Error("expected provider selection rejection"); expect(explicit.error).toBeInstanceOf(ProviderSelectionError); if (explicit.error instanceof ProviderSelectionError) diff --git a/src/application/binary/AnalysisSnapshotCache.test.ts b/src/application/binary/AnalysisSnapshotCache.test.ts index 5a7472ba4..32776d034 100644 --- a/src/application/binary/AnalysisSnapshotCache.test.ts +++ b/src/application/binary/AnalysisSnapshotCache.test.ts @@ -230,7 +230,6 @@ describe("analysis snapshot cache partitioning", () => { ANALYSIS_SNAPSHOT_PROFILE, createEvidenceBundle([evidence]), ); - expect(exported.ok).toBe(true); if (!exported.ok) throw new Error("snapshot export failed"); const tampered = structuredClone(exported.value); const tamperedEntry = tampered.entries[0]; diff --git a/src/application/javascript/JavaScriptApplicationCancellation.test.ts b/src/application/javascript/JavaScriptApplicationCancellation.test.ts index 8b2cc7504..570722048 100644 --- a/src/application/javascript/JavaScriptApplicationCancellation.test.ts +++ b/src/application/javascript/JavaScriptApplicationCancellation.test.ts @@ -43,7 +43,6 @@ describe("JavaScript analysis cancellation before publication", () => { }, ); expect(requested).toBe(true); - expect(result.ok).toBe(false); if (result.ok) throw new Error("Cancelled analysis must not publish Evidence"); expect(projectAnalysisError(result.error)).toMatchObject({ @@ -68,7 +67,6 @@ describe("JavaScript analysis cancellation before publication", () => { }, }, ); - expect(result.ok).toBe(false); if (result.ok) throw new Error("Expected cancellation before admission"); expect(projectAnalysisError(result.error)).toMatchObject({ details: { reason: "cancelled" }, diff --git a/src/application/javascript/JavaScriptApplicationService.test.ts b/src/application/javascript/JavaScriptApplicationService.test.ts index 83e93e713..7ccdad6d6 100644 --- a/src/application/javascript/JavaScriptApplicationService.test.ts +++ b/src/application/javascript/JavaScriptApplicationService.test.ts @@ -30,7 +30,6 @@ describe("JavaScript application failure diagnostics", () => { }, ); - expect(result.ok).toBe(false); if (result.ok) throw new Error("Expected analysis failure"); expect(result.error.cause).toBe(cause); expect(projectAnalysisError(result.error)).toMatchObject({ @@ -59,7 +58,6 @@ describe("JavaScript application failure diagnostics", () => { }, }, ); - expect(result.ok).toBe(false); if (result.ok) throw new Error("Expected analysis failure"); expect(result.error.cause).toBe(cause); expect(projectAnalysisError(result.error)).toMatchObject({ @@ -84,7 +82,6 @@ describe("JavaScript application failure diagnostics", () => { input_path: join(root, "missing"), format: "directory", }); - expect(result.ok).toBe(false); if (result.ok) throw new Error("Expected missing artifact failure"); expect(projectAnalysisError(result.error)).toMatchObject({ code: "artifact_operation_failed", @@ -107,7 +104,6 @@ describe("JavaScript application failure diagnostics", () => { }, }, ); - expect(result.ok).toBe(false); if (result.ok) throw new Error("Expected analysis failure"); expect(projectAnalysisError(result.error)).toMatchObject({ code: "execution_failure", @@ -140,7 +136,6 @@ describe("JavaScript application failure diagnostics", () => { }, }, ); - expect(result.ok).toBe(false); if (result.ok) throw new Error("Expected analysis failure"); expect(projectAnalysisError(result.error)).toMatchObject({ code: "execution_failure", diff --git a/src/application/javascript/JavaScriptFileUrlPaths.test.ts b/src/application/javascript/JavaScriptFileUrlPaths.test.ts index fcb63d7da..151b9b756 100644 --- a/src/application/javascript/JavaScriptFileUrlPaths.test.ts +++ b/src/application/javascript/JavaScriptFileUrlPaths.test.ts @@ -61,7 +61,6 @@ describe("source-relative file URL paths", () => { input_path: root, format: "directory", }); - expect(result.ok).toBe(true); if (!result.ok) throw result.error; const { graph } = javascriptApplicationAnalysisResultSchema.parse( result.value.normalized_result, diff --git a/src/application/javascript/JavaScriptModuleSpecifierPaths.test.ts b/src/application/javascript/JavaScriptModuleSpecifierPaths.test.ts index 6d4ac24be..937773000 100644 --- a/src/application/javascript/JavaScriptModuleSpecifierPaths.test.ts +++ b/src/application/javascript/JavaScriptModuleSpecifierPaths.test.ts @@ -124,7 +124,6 @@ describe("ESM module URL decoding", () => { input_path: root, format: "directory", }); - expect(result.ok).toBe(true); if (!result.ok) throw result.error; const { graph } = javascriptApplicationAnalysisResultSchema.parse( result.value.normalized_result, @@ -235,7 +234,6 @@ describe("package exports URL paths", () => { input_path: root, format: "directory", }); - expect(result.ok).toBe(true); if (!result.ok) throw result.error; const { graph } = javascriptApplicationAnalysisResultSchema.parse( result.value.normalized_result, diff --git a/src/application/javascript/JavaScriptRecoveryService.test.ts b/src/application/javascript/JavaScriptRecoveryService.test.ts index f8ed97653..0e5358ebd 100644 --- a/src/application/javascript/JavaScriptRecoveryService.test.ts +++ b/src/application/javascript/JavaScriptRecoveryService.test.ts @@ -111,7 +111,6 @@ describe("JavaScript recovery workflow", () => { ), }); const result = await service.recover(input); - expect(result.ok).toBe(false); if (result.ok) throw new Error("expected invalid port output"); expect(result.error._tag).toBe("AnalysisOutputError"); }); diff --git a/src/browser/PlaywrightBrowserScenarioProvider.test.ts b/src/browser/PlaywrightBrowserScenarioProvider.test.ts index e97aac402..3c9a9304f 100644 --- a/src/browser/PlaywrightBrowserScenarioProvider.test.ts +++ b/src/browser/PlaywrightBrowserScenarioProvider.test.ts @@ -198,7 +198,6 @@ describe("PlaywrightBrowserScenarioProvider", () => { const result = await provider.captureScenario( scenario({ events: ["frames"] }), ); - expect(result.ok).toBe(true); if (!result.ok) throw result.error; expect(result.value.completeness).toMatchObject({ status: "incomplete", diff --git a/src/config.test.ts b/src/config.test.ts index 303203c2f..dd228e4a6 100644 --- a/src/config.test.ts +++ b/src/config.test.ts @@ -82,7 +82,6 @@ describe("runtime configuration", () => { describe("runtime target configuration", () => { it("rejects invalid target kinds with actionable environment diagnostics", () => { const result = parseConfig({ HOPPER_TARGET_KIND: "archive" }); - expect(result.ok).toBe(false); if (result.ok) throw new Error("Expected invalid target kind"); expect(result.error.message).toContain("Invalid REA environment"); }); @@ -121,7 +120,6 @@ describe("runtime collection configuration", () => { HOPPER_TARGET_PATH: "/tmp/a", HOPPER_LOADER_ARGS_JSON: encoded, }); - expect(result.ok).toBe(false); if (result.ok) throw new Error("expected malformed loader arguments to fail"); expect(result.error.message).toContain( diff --git a/src/domain/safeJson.test.ts b/src/domain/safeJson.test.ts index ff198a0bc..cb8c88d1a 100644 --- a/src/domain/safeJson.test.ts +++ b/src/domain/safeJson.test.ts @@ -5,7 +5,6 @@ import { safeParseJson } from "./safeJson.js"; it("keeps the original JSON parse failure as the cause", () => { const parsed = safeParseJson("{"); - expect(parsed.ok).toBe(false); if (parsed.ok) throw new Error("expected invalid JSON to fail"); expect(parsed.error).toContain("JSON"); expect(parsed.cause).toBeInstanceOf(SyntaxError); diff --git a/src/ghidra/GhidraFunctionValues.test.ts b/src/ghidra/GhidraFunctionValues.test.ts index d93f22f2b..62b3b6b65 100644 --- a/src/ghidra/GhidraFunctionValues.test.ts +++ b/src/ghidra/GhidraFunctionValues.test.ts @@ -185,7 +185,6 @@ describe("Ghidra jump-table mapping contract", () => { ], }, }); - expect(parsed.ok).toBe(true); if (!parsed.ok) throw parsed.error; const output = functionDossierSchema.parse(parsed.value).native_api; if (output?.available !== true) @@ -218,7 +217,6 @@ describe("Ghidra jump-table mapping contract", () => { ], }, }); - expect(parsed.ok).toBe(true); if (!parsed.ok) throw parsed.error; expect(functionDossierSchema.parse(parsed.value).native_api).toMatchObject({ jump_tables: [{ default_targets: [], mappings: [{ case_value: null }] }], diff --git a/src/ghidra/GhidraProvider.behavior.test.ts b/src/ghidra/GhidraProvider.behavior.test.ts index 9cc337c9e..cff1ba04a 100644 --- a/src/ghidra/GhidraProvider.behavior.test.ts +++ b/src/ghidra/GhidraProvider.behavior.test.ts @@ -428,7 +428,6 @@ describe("Ghidra client projection", () => { executableTarget("elf", "x86_64"), ); - expect(resolved.ok).toBe(true); if (!resolved.ok) throw resolved.error; if (resolved.value.profile === null) throw new Error("Expected a bound Ghidra profile"); diff --git a/src/ida/IdaSessionClient.test.ts b/src/ida/IdaSessionClient.test.ts index 30ef7e07e..554a81f0f 100644 --- a/src/ida/IdaSessionClient.test.ts +++ b/src/ida/IdaSessionClient.test.ts @@ -163,7 +163,6 @@ describe("attached IDA function observations", () => { const result = await client.execute("analyze_function", { procedure: "0x1004", }); - expect(result.ok).toBe(true); if (!result.ok) throw result.error; const dossier = functionDossierSchema.parse(result.value.result); expect(dossier.procedure.address).toBe("0x1000"); @@ -367,7 +366,6 @@ describe("headless IDA session ownership and cleanup", () => { const result = await client.execute("analyze_function", { procedure: "main", }); - expect(result.ok).toBe(true); if (!result.ok) throw result.error; expect(producer.inputPath).not.toBe(target.path); expect(await readFile(producer.inputPath)).toEqual(original); diff --git a/src/process/capture/ProcessHarness.test.ts b/src/process/capture/ProcessHarness.test.ts index 2d4a2832f..0f647918c 100644 --- a/src/process/capture/ProcessHarness.test.ts +++ b/src/process/capture/ProcessHarness.test.ts @@ -500,7 +500,6 @@ it("fails closed on Windows before resolving or launching scenario paths", async working_directory: "Z:/missing/working-directory", }); const result = await captureProcessScenario(scenario, undefined, "win32"); - expect(result.ok).toBe(false); if (result.ok) throw new Error("expected Windows ownership refusal"); if (!(result.error instanceof AnalysisCapabilityUnavailableError)) throw new Error("expected a capability-unavailable outcome"); diff --git a/src/server/toolResultEncoding.test.ts b/src/server/toolResultEncoding.test.ts index 367d1bfe9..6ac42f58b 100644 --- a/src/server/toolResultEncoding.test.ts +++ b/src/server/toolResultEncoding.test.ts @@ -15,7 +15,6 @@ describe("MCP result encoding budget", () => { { result: "x".repeat(8191) + "πŸ˜€" + 'δΈ­ζ–‡\n"'.repeat(20000) }, ])("counts actual UTF-8 structured and escaped text bytes", (candidate) => { const encoded = encodeToolResult(candidate); - expect(encoded.ok).toBe(true); if (!encoded.ok) throw new Error("Expected complete encoding"); expect(encoded.text).toBe(JSON.stringify(candidate)); expect(encoded.bytes).toBe( diff --git a/tests/boundary/android/jadxIntegration.test.ts b/tests/boundary/android/jadxIntegration.test.ts index bd14f3515..a4c993847 100644 --- a/tests/boundary/android/jadxIntegration.test.ts +++ b/tests/boundary/android/jadxIntegration.test.ts @@ -216,7 +216,6 @@ it("retains APK identity, original input, raw producer data and normalized obser const outcome = await service.execute("inspect_android_package", { path: apk, }); - expect(outcome.ok).toBe(true); if (!outcome.ok) throw outcome.error; const result = androidResultSchemas.inspect_android_package.parse( outcome.value.normalized_result, diff --git a/tests/boundary/browser/cdpBrowserProvider.targetInventory.test.ts b/tests/boundary/browser/cdpBrowserProvider.targetInventory.test.ts index f03a6b0f9..cae84925e 100644 --- a/tests/boundary/browser/cdpBrowserProvider.targetInventory.test.ts +++ b/tests/boundary/browser/cdpBrowserProvider.targetInventory.test.ts @@ -56,7 +56,6 @@ describe("CDP target inventory", () => { allowed_origins: ["https://allowed.example"], }); - expect(result.ok).toBe(true); if (!result.ok) throw result.error; expect(result.value.targets).toHaveLength(targets.length); expect(result.value.targets[0]?.target_id).toBe("target-0000"); diff --git a/tests/boundary/browser/cdpBrowserProvider.timelineEvents.test.ts b/tests/boundary/browser/cdpBrowserProvider.timelineEvents.test.ts index e9f1f9a60..4a707c1ab 100644 --- a/tests/boundary/browser/cdpBrowserProvider.timelineEvents.test.ts +++ b/tests/boundary/browser/cdpBrowserProvider.timelineEvents.test.ts @@ -25,7 +25,6 @@ describe("CdpBrowserProvider navigation timeline", () => { }), ); - expect(result.ok).toBe(true); if (!result.ok) throw result.error; expect(result.value.timeline).toHaveLength(additionalEvents + 6); expect(result.value.completeness.truncated_sections).not.toContain( diff --git a/tests/boundary/browser/cdpWebRuntime.test.ts b/tests/boundary/browser/cdpWebRuntime.test.ts index 5cbf6c9e9..ac9049c62 100644 --- a/tests/boundary/browser/cdpWebRuntime.test.ts +++ b/tests/boundary/browser/cdpWebRuntime.test.ts @@ -281,7 +281,6 @@ describe("runtime lifecycle and invalid producer data", () => { }, }, ); - expect(result.ok).toBe(false); if (result.ok) throw new Error("Cancellation must not produce successful evidence"); expect(result.error._tag).toBe("AnalysisCancelledError"); @@ -297,7 +296,6 @@ describe("runtime lifecycle and invalid producer data", () => { unsupportedMethods: ["Profiler.stopPreciseCoverage"], }); const result = await provider.observeExecution(execution); - expect(result.ok).toBe(false); if (result.ok) throw new Error("Failed cleanup must not return success"); expect(result.error.cleanupIncomplete).toBe(true); expect( diff --git a/tests/boundary/filesystem/binaryTarget.test.ts b/tests/boundary/filesystem/binaryTarget.test.ts index f6f87f681..e9da6d234 100644 --- a/tests/boundary/filesystem/binaryTarget.test.ts +++ b/tests/boundary/filesystem/binaryTarget.test.ts @@ -523,7 +523,6 @@ describe("iOS-style app bundle targets", () => { await chmod(wrapper, 0o000); try { const result = await parseBinaryTarget(app, directory, "arm64"); - expect(result.ok).toBe(false); if (result.ok) throw new Error("Expected a permission denial"); expect(result.error.message).toContain("permission denied"); } finally { @@ -564,7 +563,6 @@ describe("iOS-style app bundle targets", () => { await writeFile(join(app, "Info.plist"), plist("Escaping")); await symlink(outside, join(app, "Escaping")); const result = await parseBinaryTarget(app, directory, "arm64"); - expect(result.ok).toBe(false); if (result.ok) throw new Error("Expected an escaping program file"); expect(result.error.message).toContain("leaves the bundle root"); }, diff --git a/tests/boundary/filesystem/referenceSourceImport.test.ts b/tests/boundary/filesystem/referenceSourceImport.test.ts index adec0d847..7c4c60c0a 100644 --- a/tests/boundary/filesystem/referenceSourceImport.test.ts +++ b/tests/boundary/filesystem/referenceSourceImport.test.ts @@ -337,7 +337,6 @@ describe("reference source import behavior", () => { message: "fixture", }); const result = await importTree(root); - expect(result.ok).toBe(true); if (!result.ok) throw result.error; expect(result.value.vcs).toEqual({ kind: "git", head: oid, dirty: null }); } finally { diff --git a/tests/boundary/filesystem/webScriptExport.test.ts b/tests/boundary/filesystem/webScriptExport.test.ts index 2ae9062f8..cae439fea 100644 --- a/tests/boundary/filesystem/webScriptExport.test.ts +++ b/tests/boundary/filesystem/webScriptExport.test.ts @@ -176,7 +176,6 @@ describe("captured script publication failures and cleanup", () => { const { input } = await setup(); await writeFile(input.capture_path, bytes); const result = await exportWebScripts(input); - expect(result.ok).toBe(false); if (result.ok) throw new Error("Expected invalid input"); expect(result.error._tag).toBe("AnalysisInputError"); await expect(access(input.output_directory)).rejects.toMatchObject({ @@ -195,7 +194,6 @@ describe("captured script publication failures and cleanup", () => { process.platform === "win32" ? "junction" : "dir", ); const result = await exportWebScripts(input); - expect(result.ok).toBe(false); if (result.ok) throw new Error("Expected exclusive output failure"); expect(result.error.userMessage).toContain("already exists"); expect(await readFile(marker, "utf8")).toBe("keep"); @@ -229,7 +227,6 @@ describe("captured script publication failures and cleanup", () => { const controller = new AbortController(); controller.abort(); const result = await exportWebScripts(input, { signal: controller.signal }); - expect(result.ok).toBe(false); if (result.ok) throw new Error("Expected cancellation"); expect(result.error._tag).toBe("AnalysisCancelledError"); await expect( @@ -249,7 +246,6 @@ describe("captured script publication failures and cleanup", () => { ...input, capture_path: `${input.capture_path}.missing`, }); - expect(missing.ok).toBe(false); if (missing.ok) throw new Error("Expected unavailable input"); expect(missing.error.userMessage).toContain( `${input.capture_path}.missing`, @@ -258,7 +254,6 @@ describe("captured script publication failures and cleanup", () => { ...input, capture_path: "capture.json", }); - expect(relative.ok).toBe(false); if (relative.ok) throw new Error("Expected host path error"); expect(relative.error._tag).toBe("AnalysisInputError"); }); diff --git a/tests/boundary/inspector/javascriptRuntimeUnresolvedTarget.test.ts b/tests/boundary/inspector/javascriptRuntimeUnresolvedTarget.test.ts index e08027d4f..d56518032 100644 --- a/tests/boundary/inspector/javascriptRuntimeUnresolvedTarget.test.ts +++ b/tests/boundary/inspector/javascriptRuntimeUnresolvedTarget.test.ts @@ -22,7 +22,6 @@ test("keeps unresolved target identity unknown while matching verified loaded sc try { await writeFile(entry, "export const fixture = true;\n"); const analysis = await analyzeJavaScriptApplication({ input_path: root }); - expect(analysis.ok).toBe(true); if (!analysis.ok) throw analysis.error; const provider = new V8InspectorProvider(); const input = { @@ -31,7 +30,6 @@ test("keeps unresolved target identity unknown while matching verified loaded sc observation_ms: 10, }; const observed = await provider.observe(input); - expect(observed.ok).toBe(true); if (!observed.ok) throw observed.error; const evidence = createJavaScriptRuntimeObservationEvidence( "observe_javascript_runtime", diff --git a/tests/boundary/javascript-recovery/wakaruIntegration.test.ts b/tests/boundary/javascript-recovery/wakaruIntegration.test.ts index 8acb6ecaa..8b2975788 100644 --- a/tests/boundary/javascript-recovery/wakaruIntegration.test.ts +++ b/tests/boundary/javascript-recovery/wakaruIntegration.test.ts @@ -71,7 +71,6 @@ describe.skipIf(process.platform !== "linux" || process.arch !== "x64")( path: fixture.path, output_directory: fixture.output, }); - expect(result.ok).toBe(false); if (result.ok) throw new Error("expected boundary failure"); const error = projectAnalysisError(result.error); expect(["execution_failure", "unreadable_output"]).toContain( @@ -91,7 +90,6 @@ describe.skipIf(process.platform !== "linux" || process.arch !== "x64")( path: fixture.path, output_directory: fixture.output, }); - expect(result.ok).toBe(false); if (result.ok) throw new Error("expected invalid UTF-8 boundary"); expect(JSON.stringify(projectAnalysisError(result.error))).toContain( "UTF-8 byte range", @@ -131,7 +129,6 @@ describe.skipIf(process.platform !== "linux" || process.arch !== "x64")( path: fixture.path, output_directory: fixture.output, }); - expect(result.ok).toBe(false); if (result.ok) throw new Error("expected existing-output rejection"); expect(projectAnalysisError(result.error)).toMatchObject({ code: "invalid_request", diff --git a/tests/boundary/mcp/enhancedTools.03-returns-typed-graph-failures-and.test.ts b/tests/boundary/mcp/enhancedTools.03-returns-typed-graph-failures-and.test.ts index 989b994c4..035689b58 100644 --- a/tests/boundary/mcp/enhancedTools.03-returns-typed-graph-failures-and.test.ts +++ b/tests/boundary/mcp/enhancedTools.03-returns-typed-graph-failures-and.test.ts @@ -98,7 +98,6 @@ describe("enhanced MCP tools", () => { ); expect(calls).toBe(1); - expect(result.ok).toBe(false); if (result.ok) throw new Error("expected cancellation"); expect(result.error._tag).toBe("AnalysisCancelledError"); }); diff --git a/tests/boundary/process/processCaptureLifecycle.test.ts b/tests/boundary/process/processCaptureLifecycle.test.ts index fdd1bba40..3ece19b77 100644 --- a/tests/boundary/process/processCaptureLifecycle.test.ts +++ b/tests/boundary/process/processCaptureLifecycle.test.ts @@ -253,7 +253,6 @@ itWithCaptureCapability( cleanupHost, ); - expect(result.ok).toBe(false); if (result.ok) throw new Error("expected cleanup-incomplete failure"); if (!(result.error instanceof ProcessCaptureError)) throw result.error; const partial = result.error.partialObservation; @@ -455,7 +454,6 @@ itWithCaptureCapability( }), controller.signal, ); - expect(cancelled.ok).toBe(false); if (cancelled.ok) throw new Error("expected cancellation"); expect(cancelled.error.message).toContain("cancelled"); }, @@ -486,7 +484,6 @@ itWithCaptureCapability( signal, ); - expect(result.ok).toBe(false); if (result.ok) throw new Error("expected initial snapshot cancellation"); expect(result.error).toMatchObject({ reason: "cancelled", @@ -522,7 +519,6 @@ itWithCaptureCapability( ); const result = await resultPromise; - expect(result.ok).toBe(false); if (result.ok) throw new Error("expected final snapshot cancellation"); expect(initialSnapshotCompleted).toBe(true); expect(result.error).toMatchObject({ @@ -560,7 +556,6 @@ itWithCaptureCapability( captureSnapshot, ); - expect(result.ok).toBe(false); if (result.ok) throw new Error("expected filesystem observation failure"); expect(result.error).toMatchObject({ reason: "capture_failed", diff --git a/tests/boundary/providers/managed/managedArmMachine.test.ts b/tests/boundary/providers/managed/managedArmMachine.test.ts index 7680423b8..f708b0b31 100644 --- a/tests/boundary/providers/managed/managedArmMachine.test.ts +++ b/tests/boundary/providers/managed/managedArmMachine.test.ts @@ -15,7 +15,6 @@ it.each([0x01c0, 0x01c2, 0x01c4])( const path = join(directory, "fixture.exe"); await writeFile(path, bytes); const parsed = await parseBinaryTarget(path); - expect(parsed.ok).toBe(true); if (!parsed.ok) throw parsed.error; expect(parsed.value).toMatchObject({ kind: "executable", @@ -31,7 +30,6 @@ it.each([0x01c0, 0x01c2, 0x01c4])( "inspect_managed_native_boundaries", ] as const) { const observed = await client.execute(operation, {}); - expect(observed.ok).toBe(true); if (!observed.ok) throw observed.error; expect(observed.value.subject).toMatchObject({ path, diff --git a/tests/boundary/providers/native/nativeSignatureTargetBinding.test.ts b/tests/boundary/providers/native/nativeSignatureTargetBinding.test.ts index e1e75225d..ae2a30d76 100644 --- a/tests/boundary/providers/native/nativeSignatureTargetBinding.test.ts +++ b/tests/boundary/providers/native/nativeSignatureTargetBinding.test.ts @@ -86,7 +86,6 @@ describe("native signature target identity", () => { const result = await new NativeMacOSProvider(runner, "darwin") .createClient(target) .execute("inspect_signature", {}); - expect(result.ok).toBe(false); if (result.ok) throw new Error("Expected target-change failure"); expect(projectAnalysisError(result.error)).toMatchObject({ code: "artifact_changed", @@ -113,7 +112,6 @@ describe("native signature target identity", () => { const result = await new NativeMacOSProvider(runner, "darwin") .createClient(target) .execute("inspect_signature", {}); - expect(result.ok).toBe(false); if (result.ok) throw new Error("Expected target-change failure"); expect(projectAnalysisError(result.error)).toMatchObject({ code: "artifact_changed", @@ -132,7 +130,6 @@ describe("native signature target identity", () => { const result = await new NativeMacOSProvider(runner, "darwin") .createClient(target) .execute("inspect_signature", {}); - expect(result.ok).toBe(false); if (result.ok) throw new Error("Expected access denial"); expect(projectAnalysisError(result.error)).toMatchObject({ code: "access_denied", @@ -156,7 +153,6 @@ describe("native signature target identity", () => { const result = await new NativeMacOSProvider(runner, "darwin") .createClient(target) .execute("inspect_signature", {}); - expect(result.ok).toBe(false); if (result.ok) throw new Error("Expected access denial"); expect(projectAnalysisError(result.error)).toMatchObject({ code: "access_denied", diff --git a/tests/boundary/providers/native/nativeTextRobustness.test.ts b/tests/boundary/providers/native/nativeTextRobustness.test.ts index 7f1791254..256aa0a98 100644 --- a/tests/boundary/providers/native/nativeTextRobustness.test.ts +++ b/tests/boundary/providers/native/nativeTextRobustness.test.ts @@ -70,7 +70,6 @@ it("accepts a byte-order mark before plist JSON", () => { const parsed = parsePlistJson( '\uFEFF{"CFBundleIdentifier":"com.owned.fixture"}', ); - expect(parsed.ok).toBe(true); if (!parsed.ok) throw new Error("expected plist JSON to parse"); expect(parsed.value.bundle.identifier).toBe("com.owned.fixture"); }); diff --git a/tests/composition/analysis-sessions/appleApplication.test.ts b/tests/composition/analysis-sessions/appleApplication.test.ts index 7fca0260c..d944e4f16 100644 --- a/tests/composition/analysis-sessions/appleApplication.test.ts +++ b/tests/composition/analysis-sessions/appleApplication.test.ts @@ -61,7 +61,6 @@ async function createCompleteAppleProjection() { inventory_evidence: fragments, }); - expect(result.ok).toBe(true); if (!result.ok) throw new TypeError("Could not project fixture inventory"); const projection = appleApplicationProjectionResultSchema.parse( result.value.normalized_result, diff --git a/tests/composition/analysis-sessions/managedApplicationGraph.test.ts b/tests/composition/analysis-sessions/managedApplicationGraph.test.ts index 9930b9795..1bc93d8a1 100644 --- a/tests/composition/analysis-sessions/managedApplicationGraph.test.ts +++ b/tests/composition/analysis-sessions/managedApplicationGraph.test.ts @@ -200,7 +200,6 @@ describe("managed application graph coverage", () => { managed_members: parserPartialEvidence, }); - expect(parserPartialProjection.ok).toBe(true); if (!parserPartialProjection.ok) throw new Error("partial projection failed"); const parserPartialResult = managedApplicationGraphResultSchema.parse( diff --git a/tests/composition/idaProvider.test.ts b/tests/composition/idaProvider.test.ts index 3ef107280..dad7270ba 100644 --- a/tests/composition/idaProvider.test.ts +++ b/tests/composition/idaProvider.test.ts @@ -43,7 +43,6 @@ describe("IDA provider composition", () => { diagnostics: { live_connection_probed: false }, }); const resolution = await provider.resolveAnalysisProfile(target); - expect(resolution.ok).toBe(true); if (!resolution.ok) throw resolution.error; expect(resolution.value.profile.parameters).toMatchObject({ engine_version: null, @@ -75,7 +74,6 @@ describe("IDA provider composition", () => { const first = await session.execute("procedure_pseudo_code", query); expect(first.ok && first.value.result).toContain("42"); const snapshot = session.exportAnalysisSnapshot(); - expect(snapshot.ok).toBe(true); if (!snapshot.ok) throw snapshot.error; expect(snapshot.value.entries).toEqual([]); const profile = session.analysisProfile(); diff --git a/tests/conformance/contracts/mcpResponseBudget.test.ts b/tests/conformance/contracts/mcpResponseBudget.test.ts index 206f8b930..857e56888 100644 --- a/tests/conformance/contracts/mcpResponseBudget.test.ts +++ b/tests/conformance/contracts/mcpResponseBudget.test.ts @@ -42,7 +42,6 @@ describe("MCP response budget configuration", () => { "9007199254740992", ])("rejects malformed or unusable budgets: %j", (value) => { const parsed = parseMcpResponseBudget(value); - expect(parsed.ok).toBe(false); if (parsed.ok) throw new Error("Expected invalid budget"); expect(parsed.error.message).toContain("REA_MCP_MAX_RESPONSE_BYTES"); });