Fix more edge-case embed formatting

This commit is contained in:
Cadence Ember 2023-10-28 00:24:42 +13:00
parent 762e48230c
commit afbbe0da3d
12 changed files with 428 additions and 127 deletions

View file

@ -368,7 +368,7 @@ test("event2message: lists are bridged correctly", async t => {
messagesToEdit: [],
messagesToSend: [{
username: "cadence [they]",
content: "* line one\n* line two\n* line three\n * nested one\n * nested two\n* line four",
content: "* line one\n* line two\n* line three\n * nested one\n * nested two\n* line four",
avatar_url: undefined
}]
}
@ -498,6 +498,47 @@ test("event2message: quotes have an appropriate amount of whitespace", async t =
)
})
test("event2message: lists have appropriate line breaks", async t => {
t.deepEqual(
await eventToMessage({
content: {
body: 'i am not certain what you mean by "already exists with as discord". my goals are\n' +
'* bridgeing specific channels with existing matrix rooms\n' +
' * optionally maybe entire "servers"\n' +
'* offering the bridge as a public service ',
format: 'org.matrix.custom.html',
formatted_body: '<p>i am not certain what you mean by "already exists with as discord". my goals are</p>\n' +
'<ul>\n' +
'<li>bridgeing specific channels with existing matrix rooms\n' +
'<ul>\n' +
'<li>optionally maybe entire "servers"</li>\n' +
'</ul>\n' +
'</li>\n' +
'<li>offering the bridge as a public service</li>\n' +
'</ul>\n',
'm.mentions': {},
msgtype: 'm.text'
},
room_id: '!cBxtVRxDlZvSVhJXVK:cadence.moe',
sender: '@Milan:tchncs.de',
type: 'm.room.message',
}, {}, {
api: {
getStateEvent: async () => ({displayname: "Milan"})
}
}),
{
messagesToDelete: [],
messagesToEdit: [],
messagesToSend: [{
username: "Milan",
content: `i am not certain what you mean by "already exists with as discord". my goals are\n\n* bridgeing specific channels with existing matrix rooms\n * optionally maybe entire "servers"\n* offering the bridge as a public service`,
avatar_url: undefined
}]
}
)
})
test("event2message: m.emote plaintext works", async t => {
t.deepEqual(
await eventToMessage({