Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
H-Shay committed Oct 1, 2024
1 parent 7de0ef1 commit b7463ef
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/integration/nsfwProtectionTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,20 @@ describe("Test: NSFW protection", function () {
let content = {"msgtype": "m.image", "body": "test.jpeg", "url": mxc};
let imageMessage = await client.sendMessage(room, content);

let formatted_body = `<img src=${mxc} />`
let htmlContent = {
msgtype: "m.image",
body: formatted_body,
format: "org.matrix.custom.html",
formatted_body: formatted_body
};
let htmlMessage = await client.sendMessage(room, htmlContent)

await delay(500);
let processedImage = await client.getEvent(room, imageMessage);
assert.equal(Object.keys(processedImage.content).length, 0, "This event should have been redacted");

let processedHtml = await client.getEvent(room, htmlMessage)
assert.equal(Object.keys(processedHtml.content).length, 0, "This html image event should have been redacted")
});
});

0 comments on commit b7463ef

Please sign in to comment.