test: remove duplicate result assertions before throwing guards

This commit is contained in:
morluto
2026-10-09 02:58:03 +08:00
parent 5945915f91
commit a1b7d40bb0
33 changed files with 0 additions and 62 deletions
@@ -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,
@@ -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",
@@ -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");
});