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
Browse files Browse the repository at this point in the history
  • Loading branch information
twouters committed Mar 9, 2022
1 parent e168b0e commit d38d861
Showing 1 changed file with 19 additions and 0 deletions.
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 d38d861

Please sign in to comment.