mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 16:34:45 +00:00
test: tighten tlon media send assertions
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user