mirror of
https://gitdab.com/cadence/out-of-your-element.git
synced 2025-09-10 12:22:50 +02:00
WIP tests for via parameters
This commit is contained in:
parent
a9f57fc252
commit
789a90a893
2 changed files with 58 additions and 6 deletions
|
@ -62,15 +62,41 @@ test("message2event: simple user mention", async t => {
|
|||
})
|
||||
|
||||
test("message2event: simple room mention", async t => {
|
||||
const events = await messageToEvent(data.message.simple_room_mention, data.guild.general, {})
|
||||
let called = 0
|
||||
const events = await messageToEvent(data.message.simple_room_mention, data.guild.general, {}, {
|
||||
api: {
|
||||
async getStateEvent(roomID, type, key) {
|
||||
called++
|
||||
t.equal(roomID, "!kLRqKKUQXcibIMtOpl:cadence.moe")
|
||||
t.equal(type, "m.room.power_levels")
|
||||
t.equal(key, "")
|
||||
return {
|
||||
users: {
|
||||
"@_ooye_bot:cadence.moe": 100
|
||||
}
|
||||
}
|
||||
},
|
||||
async getJoinedMembers(roomID) {
|
||||
called++
|
||||
t.equal(roomID, "!kLRqKKUQXcibIMtOpl:cadence.moe")
|
||||
return {
|
||||
joined: {
|
||||
"@_ooye_bot:cadence.moe": {display_name: null, avatar_url: null},
|
||||
"@user:matrix.org": {display_name: null, avatar_url: null}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
t.deepEqual(events, [{
|
||||
$type: "m.room.message",
|
||||
"m.mentions": {},
|
||||
msgtype: "m.text",
|
||||
body: "#main",
|
||||
format: "org.matrix.custom.html",
|
||||
formatted_body: '<a href="https://matrix.to/#/!kLRqKKUQXcibIMtOpl:cadence.moe">#main</a>'
|
||||
formatted_body: '<a href="https://matrix.to/#/!kLRqKKUQXcibIMtOpl:cadence.moe?via=cadence.moe&via=matrix.org">#main</a>'
|
||||
}])
|
||||
t.equal(called, 2)
|
||||
})
|
||||
|
||||
test("message2event: unknown room mention", async t => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue