mirror of
https://github.com/morluto/rea
synced 2026-10-27 06:33:32 -04:00
test: remove duplicate result assertions before throwing guards
This commit is contained in:
@@ -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" },
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user