Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

Commit

Permalink
Add test for attached blocks and version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
twouters committed Mar 9, 2022
1 parent b8076fc commit c8d72dd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "matrix-slack-parser",
"version": "0.1.7",
"version": "0.1.8",
"description": "A parser for matrix and discord messages to each others format",
"main": "./lib/src/index.js",
"scripts": {
Expand Down
19 changes: 19 additions & 0 deletions test/test_slackmessageparser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -857,5 +857,24 @@ describe("SlackMessageParser", () => {
expect(ret.body).to.equal("byebye\n");
expect(ret.formatted_body).to.equal("<p><sup>byebye</sup><br></p>");
});
it("should handle attachments with blocks", async () => {
const event = {
text: "blocks attached",
attachments: [{
blocks: [{
type: 'section',
block_id: '12rD',
text: {
type: 'mrkdwn',
text: '*BOLD*: hello',
verbatim: false
}
}],
}],
} as any;
const ret = await messageParser.FormatMessage({} as any, event);
expect(ret.body).to.equal("blocks attached\n---------------------\n");
expect(ret.formatted_body).to.equal("blocks attached<br><hr><p><p><strong>BOLD</strong>: hello</p></p>");
});
});
});

0 comments on commit c8d72dd

Please sign in to comment.