Skip to content

Commit 758f6d7

Browse files
committed
fix: add type guards for test assertions
1 parent 1b5b6e6 commit 758f6d7

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/core/mentions/__tests__/imageMentions.spec.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,15 @@ describe("Image Mentions", () => {
8686
20, // maxTotalImageSize
8787
)
8888

89-
expect(result.text).toContain("'test/image.png' (see below for image)")
90-
expect(result.text).toContain('<image_content path="test/image.png">')
91-
expect(result.text).toContain("Image (500 KB)")
92-
expect(result.images).toHaveLength(1)
93-
expect(result.images[0]).toBe(mockImageDataUrl)
89+
// Type guard for TypeScript
90+
expect(typeof result).toBe("object")
91+
if (typeof result === "object") {
92+
expect(result.text).toContain("'test/image.png' (see below for image)")
93+
expect(result.text).toContain('<image_content path="test/image.png">')
94+
expect(result.text).toContain("Image (500 KB)")
95+
expect(result.images).toHaveLength(1)
96+
expect(result.images[0]).toBe(mockImageDataUrl)
97+
}
9498
})
9599

96100
it("should handle multiple image mentions", async () => {

0 commit comments

Comments
 (0)