Skip to content

Commit dc70841

Browse files
committed
test: assert imessage reaction context
1 parent 7a8d86b commit dc70841

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

extensions/imessage/src/monitor/inbound-processing.test.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ describe("resolveIMessageInboundDecision echo detection", () => {
577577
isKnownFromMeMessageId: undefined,
578578
});
579579

580-
expect(decision).toMatchObject({ kind: "reaction" });
580+
expect(decision.kind).toBe("reaction");
581581
if (decision.kind !== "reaction") {
582582
throw new Error("expected reaction decision");
583583
}
@@ -685,7 +685,7 @@ describe("resolveIMessageInboundDecision echo detection", () => {
685685

686686
describe("resolveIMessageReactionContext", () => {
687687
it("detects legacy tapback text without treating normal prose as a reaction", () => {
688-
expect(resolveIMessageReactionContext({}, "Loved “Hello”")).toMatchObject({
688+
expect(resolveIMessageReactionContext({}, "Loved “Hello”")).toStrictEqual({
689689
action: "added",
690690
emoji: "❤️",
691691
targetText: "Hello",
@@ -699,7 +699,12 @@ describe("resolveIMessageReactionContext", () => {
699699
{ is_tapback: true, reaction_emoji: "👍", reacted_to_guid: "target" },
700700
"",
701701
),
702-
).toMatchObject({ action: "added", emoji: "👍", targetGuid: "target" });
702+
).toStrictEqual({
703+
action: "added",
704+
emoji: "👍",
705+
targetGuid: "target",
706+
targetGuids: ["target"],
707+
});
703708
expect(
704709
resolveIMessageReactionContext(
705710
{
@@ -709,14 +714,20 @@ describe("resolveIMessageReactionContext", () => {
709714
},
710715
"Loved “tapback proof”",
711716
),
712-
).toMatchObject({
717+
).toStrictEqual({
713718
action: "added",
714719
emoji: "❤️",
715720
targetGuid: "321D6826-1013-4DF0-B53C-6F6241EF2EF6",
721+
targetGuids: [
722+
"321D6826-1013-4DF0-B53C-6F6241EF2EF6",
723+
"p:0/321D6826-1013-4DF0-B53C-6F6241EF2EF6",
724+
],
716725
});
717-
expect(resolveIMessageReactionContext({ associated_message_type: 2001 }, "")).toMatchObject({
726+
expect(resolveIMessageReactionContext({ associated_message_type: 2001 }, "")).toStrictEqual({
718727
action: "added",
719728
emoji: "reaction",
729+
targetGuid: undefined,
730+
targetGuids: [],
720731
});
721732
expect(resolveIMessageReactionContext({ associated_message_type: 1 }, "ok")).toBeNull();
722733
});

0 commit comments

Comments
 (0)