mirror of
https://gitdab.com/cadence/out-of-your-element.git
synced 2025-09-10 12:22:50 +02:00
Code coverage
This commit is contained in:
parent
9e9f4819c7
commit
65de8aaf98
4 changed files with 128 additions and 1 deletions
|
@ -772,6 +772,38 @@ test("event2message: code blocks are uploaded as attachments instead if they con
|
|||
)
|
||||
})
|
||||
|
||||
test("event2message: code blocks are uploaded as attachments instead if they contain incompatible backticks (default to txt file extension)", async t => {
|
||||
t.deepEqual(
|
||||
await eventToMessage({
|
||||
type: "m.room.message",
|
||||
sender: "@cadence:cadence.moe",
|
||||
content: {
|
||||
msgtype: "m.text",
|
||||
body: "wrong body",
|
||||
format: "org.matrix.custom.html",
|
||||
formatted_body: 'So if you run code like this<pre><code>System.out.println("```");</code></pre>it should print a markdown formatted code block'
|
||||
},
|
||||
event_id: "$pGkWQuGVmrPNByrFELxhzI6MCBgJecr5I2J3z88Gc2s",
|
||||
room_id: "!BpMdOUkWWhFxmTrENV:cadence.moe"
|
||||
}),
|
||||
{
|
||||
ensureJoined: [],
|
||||
messagesToDelete: [],
|
||||
messagesToEdit: [],
|
||||
messagesToSend: [{
|
||||
username: "cadence [they]",
|
||||
content: "So if you run code like this `[inline_code.txt]` it should print a markdown formatted code block",
|
||||
attachments: [{id: "0", filename: "inline_code.txt"}],
|
||||
pendingFiles: [{name: "inline_code.txt", buffer: Buffer.from('System.out.println("```");')}],
|
||||
avatar_url: undefined,
|
||||
allowed_mentions: {
|
||||
parse: ["users", "roles"]
|
||||
}
|
||||
}]
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
test("event2message: characters are encoded properly in code blocks", async t => {
|
||||
t.deepEqual(
|
||||
await eventToMessage({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue