test: remove duplicate result assertions before throwing guards
This commit is contained in:
@@ -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");
|
||||
},
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user