test: tighten channel send assertions

This commit is contained in:
Shakker
2026-05-11 09:29:17 +01:00
parent 50700ccca1
commit 86a84015a9
3 changed files with 37 additions and 25 deletions

View File

@@ -67,35 +67,35 @@ describe("sendWebhookMessageDiscord activity", () => {
threadId: "thread-1",
});
expect(result).toMatchObject({
expect(result).toEqual({
messageId: "msg-1",
channelId: "thread-1",
});
expect(result.receipt).toEqual({
primaryPlatformMessageId: "msg-1",
platformMessageIds: ["msg-1"],
parts: [
{
platformMessageId: "msg-1",
kind: "text",
index: 0,
threadId: "thread-1",
raw: {
receipt: {
primaryPlatformMessageId: "msg-1",
platformMessageIds: ["msg-1"],
parts: [
{
platformMessageId: "msg-1",
kind: "text",
index: 0,
threadId: "thread-1",
raw: {
channel: "discord",
messageId: "msg-1",
channelId: "thread-1",
},
},
],
threadId: "thread-1",
sentAt: 1_700_000_000_000,
raw: [
{
channel: "discord",
messageId: "msg-1",
channelId: "thread-1",
},
},
],
threadId: "thread-1",
sentAt: 1_700_000_000_000,
raw: [
{
channel: "discord",
messageId: "msg-1",
channelId: "thread-1",
},
],
],
},
});
expect(recordChannelActivityMock).toHaveBeenCalledWith({
channel: "discord",

View File

@@ -12,7 +12,9 @@ describe("voice receive recovery", () => {
analyzeVoiceReceiveError(
new Error("Failed to decrypt: DecryptionFailed(UnencryptedWhenPassthroughDisabled)"),
),
).toMatchObject({
).toEqual({
message: "Failed to decrypt: DecryptionFailed(UnencryptedWhenPassthroughDisabled)",
isAbortLike: false,
shouldAttemptPassthrough: true,
countsAsDecryptFailure: true,
});

View File

@@ -104,13 +104,15 @@ describe("send", () => {
expect(result.ok).toBe(true);
expect(result.messageId).toBe("twitch-msg-123");
expect(result.receipt).toMatchObject({
expect(typeof result.receipt.sentAt).toBe("number");
expect({ ...result.receipt, sentAt: 0 }).toEqual({
primaryPlatformMessageId: "twitch-msg-123",
platformMessageIds: ["twitch-msg-123"],
parts: [
{
platformMessageId: "twitch-msg-123",
kind: "text",
index: 0,
raw: {
channel: "twitch",
conversationId: "testchannel",
@@ -118,6 +120,14 @@ describe("send", () => {
},
},
],
raw: [
{
channel: "twitch",
conversationId: "testchannel",
messageId: "twitch-msg-123",
},
],
sentAt: 0,
});
});