test: consolidate failure guards and trim unused fixture APIs

This commit is contained in:
morluto
2026-10-09 03:13:43 +08:00
parent 81ae838567
commit ffd9611308
38 changed files with 90 additions and 203 deletions
@@ -154,8 +154,7 @@ describe("residual unknown dependency histories", () => {
input("Does detached state remain intact?"),
mutation("detached-unknown"),
);
expect(created.ok).toBe(true);
if (!created.ok) return;
if (!created.ok) throw created.error;
Reflect.set(created.value, "status", "resolved");
const listed = store.listUnknowns();
@@ -185,8 +184,7 @@ describe("residual unknown dependency histories", () => {
input(" Is branch live? "),
mutation("one"),
);
expect(first.ok).toBe(true);
if (!first.ok) return;
if (!first.ok) throw first.error;
expect(first.value.unknown_id).toMatch(/^unk_[a-f0-9]{64}$/u);
expect(first.value.revision).toBe(1);
expect(store.listUnknowns({ severity: "high" })).toHaveLength(1);
@@ -76,7 +76,6 @@ it("keeps dynamic calls explicit and returns complete deterministic results", ()
const seedNodeId = graph.relations.find(
({ relation }) => relation === "defines",
)?.source_node_id;
expect(seedNodeId).toBeDefined();
if (seedNodeId === undefined) throw new Error("Expected a definition seed");
const first = queryJavaScriptSemanticGraph(graph, {
@@ -151,8 +151,7 @@ describe("managed decompiler reconstruction import", () => {
it("wraps imported reconstruction in Evidence", () => {
const evidence = importManagedReconstructionEvidence(exampleInput());
expect(evidence.ok).toBe(true);
if (!evidence.ok) return;
if (!evidence.ok) throw evidence.error;
expect(evidence.value).toMatchObject({
operation: "import_managed_reconstruction",
provider: { id: "rea-dotnet-workflows" },
@@ -220,8 +220,7 @@ describe("native UI action trace", () => {
const result = await tools.execute("trace_native_ui_action", {
action: "buildTapped:",
});
expect(result.ok).toBe(true);
if (!result.ok) return;
if (!result.ok) throw result.error;
const trace = nativeInvestigationTraceSchema.parse(result.value);
expect(trace.start).toBe("action");
expect(trace.nodes.map(({ id }) => id)).toContain("native:function:0x1000");
@@ -297,8 +296,7 @@ describe("bounded native UI tracing", () => {
{ action: "buildTapped:", max_depth: 3 },
);
expect(result.ok).toBe(true);
if (!result.ok) return;
if (!result.ok) throw result.error;
expect(
nativeInvestigationTraceSchema
.parse(result.value)
@@ -337,8 +335,7 @@ describe("native UI query outcomes", () => {
const result = await tools.execute("trace_native_ui_action", {
action: "button",
});
expect(result.ok).toBe(true);
if (!result.ok) return;
if (!result.ok) throw result.error;
expect(result.value).toMatchObject({ start: "action" });
});
@@ -385,8 +382,7 @@ describe("native UI query outcomes", () => {
const result = await tools.execute("trace_native_ui_action", {
action: "buildTapped:",
});
expect(result.ok).toBe(true);
if (!result.ok) return;
if (!result.ok) throw result.error;
expect(result.value).toMatchObject({
reason: "action_selector_matches_multiple_ui_connections",
nodes: [{ id: "action" }, { id: "second-action" }],