Skip to content

Commit e5dd03f

Browse files
committed
test: tighten runner image helper assertions
1 parent fc32737 commit e5dd03f

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

src/agents/pi-embedded-helpers.isbillingerrormessage.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -963,10 +963,11 @@ describe("image dimension errors", () => {
963963
const raw =
964964
'400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.84.content.1.image.source.base64.data: At least one of the image dimensions exceed max allowed size for many-image requests: 2000 pixels"}}';
965965
const parsed = parseImageDimensionError(raw);
966-
expect(parsed).not.toBeNull();
967-
expect(parsed?.maxDimensionPx).toBe(2000);
968-
expect(parsed?.messageIndex).toBe(84);
969-
expect(parsed?.contentIndex).toBe(1);
966+
expect(parsed).toMatchObject({
967+
maxDimensionPx: 2000,
968+
messageIndex: 84,
969+
contentIndex: 1,
970+
});
970971
expect(isImageDimensionErrorMessage(raw)).toBe(true);
971972
});
972973
});

src/agents/pi-embedded-runner/run.incomplete-turn.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,8 +1072,7 @@ describe("runEmbeddedPiAgent incomplete-turn safety", () => {
10721072
}),
10731073
});
10741074

1075-
expect(incompleteTurnText).not.toBeNull();
1076-
expect(incompleteTurnText).toContain("couldn't generate a response");
1075+
expect(incompleteTurnText).toEqual(expect.stringContaining("couldn't generate a response"));
10771076
});
10781077

10791078
it("surfaces tool-use terminal with pre-tool text and side effects as replay-unsafe (#76477)", () => {

src/agents/pi-embedded-runner/run/images.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,7 @@ describe("loadImageFromRef", () => {
267267
},
268268
);
269269

270-
expect(image).not.toBeNull();
271-
expect(image?.type).toBe("image");
270+
expect(image).toMatchObject({ type: "image" });
272271
expect(image?.data.length).toBeGreaterThan(0);
273272
} finally {
274273
await fs.rm(sandboxParent, { recursive: true, force: true });

0 commit comments

Comments
 (0)