From d1a98b632e336134c9d3fbbced6dca0bd732c6b7 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Fri, 14 Oct 2022 16:42:45 +0200 Subject: [PATCH] Add test to attachRelation --- .../rooms/wysiwyg_composer/message-test.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/components/views/rooms/wysiwyg_composer/message-test.ts b/test/components/views/rooms/wysiwyg_composer/message-test.ts index a762c7696e..712b671c9f 100644 --- a/test/components/views/rooms/wysiwyg_composer/message-test.ts +++ b/test/components/views/rooms/wysiwyg_composer/message-test.ts @@ -76,6 +76,27 @@ describe('message', () => { }, }); }); + + it("Should add relation to message", () => { + // When + const relation = { + rel_type: "m.thread", + event_id: "myFakeThreadId", + }; + const content = createMessageContent(message, { permalinkCreator, relation }); + + // Then + expect(content).toEqual({ + "body": message, + "format": "org.matrix.custom.html", + "formatted_body": message, + "msgtype": "m.text", + "m.relates_to": { + "event_id": "myFakeThreadId", + "rel_type": "m.thread", + }, + }); + }); }); describe('sendMessage', () => {