From d1886d6028e2ddd67ebb9897fe1c63a76e36afd7 Mon Sep 17 00:00:00 2001 From: Shakker Date: Sun, 10 May 2026 17:19:01 +0100 Subject: [PATCH] test: tighten tlon media send assertions --- extensions/tlon/src/monitor/media.test.ts | 16 +++++------ extensions/tlon/src/urbit/send.test.ts | 34 ++++++++++++++--------- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/extensions/tlon/src/monitor/media.test.ts b/extensions/tlon/src/monitor/media.test.ts index 22c54409483..2ac7430b70c 100644 --- a/extensions/tlon/src/monitor/media.test.ts +++ b/extensions/tlon/src/monitor/media.test.ts @@ -54,14 +54,14 @@ describe("tlon monitor media", () => { const result = await downloadMedia("https://example.com/photo.png"); - expect(fetchRemoteMediaMock).toHaveBeenCalledWith( - expect.objectContaining({ - url: "https://example.com/photo.png", - maxBytes: MAX_IMAGE_BYTES, - readIdleTimeoutMs: 30_000, - requestInit: { method: "GET" }, - }), - ); + expect(fetchRemoteMediaMock).toHaveBeenCalledTimes(1); + expect(fetchRemoteMediaMock).toHaveBeenCalledWith({ + url: "https://example.com/photo.png", + maxBytes: MAX_IMAGE_BYTES, + readIdleTimeoutMs: 30_000, + ssrfPolicy: undefined, + requestInit: { method: "GET" }, + }); expect(saveMediaBufferMock).toHaveBeenCalledWith( Buffer.from("image-data"), "image/png", diff --git a/extensions/tlon/src/urbit/send.test.ts b/extensions/tlon/src/urbit/send.test.ts index 5d6dd2f388c..4729365c615 100644 --- a/extensions/tlon/src/urbit/send.test.ts +++ b/extensions/tlon/src/urbit/send.test.ts @@ -55,21 +55,29 @@ describe("sendDm", () => { }); expect(scot).toHaveBeenCalledWith("ud", 1_700_000_000_000n); - expect(poke).toHaveBeenCalledWith( - expect.objectContaining({ - json: expect.objectContaining({ - channel: expect.objectContaining({ - action: { - post: { - reply: expect.objectContaining({ - id: "~2024.1.1", - }), + expect(poke).toHaveBeenCalledWith({ + app: "channels", + mark: "channel-action-1", + json: { + channel: { + nest: "chat/~nec/general", + action: { + post: { + reply: { + id: "~2024.1.1", + action: { + add: { + content: [{ inline: ["threaded"] }], + author: "~zod", + sent: 1_700_000_000_000, + }, + }, }, }, - }), - }), - }), - ); + }, + }, + }, + }); expect(result.receipt.threadId).toBe("~nec/general"); }); });