From 4167a01ed1cdeb7df2c588504f1628b62bfdb476 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Fri, 25 Oct 2024 16:51:20 +1300 Subject: [PATCH] Add test template for forwarded message --- src/d2m/converters/message-to-event.test.js | 12 ++++ test/data.js | 61 +++++++++++++++++++++ 2 files changed, 73 insertions(+) diff --git a/src/d2m/converters/message-to-event.test.js b/src/d2m/converters/message-to-event.test.js index 415f48df..20630d60 100644 --- a/src/d2m/converters/message-to-event.test.js +++ b/src/d2m/converters/message-to-event.test.js @@ -1014,3 +1014,15 @@ test("message2event: @everyone within a link", async t => { "m.mentions": {} }]) }) + +test("message2event: forwarded image", async t => { + const events = await messageToEvent(data.message.forwarded_image) + t.deepEqual(events, [{ + $type: "m.room.message", + msgtype: "m.text", + body: "https://github.com/@everyone", + format: "org.matrix.custom.html", + formatted_body: `https://github.com/@everyone`, + "m.mentions": {} + }]) +}) diff --git a/test/data.js b/test/data.js index 9dc2d723..6b491084 100644 --- a/test/data.js +++ b/test/data.js @@ -2129,6 +2129,67 @@ module.exports = { mention_everyone: false, tts: false } + }, + forwarded_image: { type: 0, + content: "", + mentions: [], + mention_roles: [], + attachments: [], + embeds: [], + timestamp: "2024-10-16T22:25:01.973000+00:00", + edited_timestamp: null, + flags: 16384, + components: [], + id: "1296237495993892916", + channel_id: "112760669178241024", + author: { + id: "113340068197859328", + username: "kumaccino", + avatar: "a8829abe66866d7797b36f0bfac01086", + discriminator: "0", + public_flags: 128, + flags: 128, + banner: null, + accent_color: null, + global_name: "kumaccino", + avatar_decoration_data: null, + banner_color: null, + clan: null + }, + pinned: false, + mention_everyone: false, + tts: false, + message_reference: { + type: 1, + channel_id: "1019762340922663022", + message_id: "1019779830469894234" + }, + position: 0, + message_snapshots: [ + { + message: { + type: 0, + content: "", + mentions: [], + mention_roles: [], + attachments: [ + { + id: "1296237494987133070", + filename: "100km.gif", + size: 2965649, + url: "https://cdn.discordapp.com/attachments/112760669178241024/1296237494987133070/100km.gif?ex=67118ebd&is=67103d3d&hm=8ed76d424f92f11366989f2ebc713d4f8206706ef712571e934da45b59944f77&", proxy_url: "https://media.discordapp.net/attachments/112760669178241024/1296237494987133070/100km.gif?ex=67118ebd&is=67103d3d&hm=8ed76d424f92f11366989f2ebc713d4f8206706ef712571e934da45b59944f77&", width: 300, + height: 300, + content_type: "image/gif" + } + ], + embeds: [], + timestamp: "2022-09-15T01:20:58.177000+00:00", + edited_timestamp: null, + flags: 0, + components: [] + } + } + ] } }, pk_message: {