[WIP] threads. #74
1 changed files with 12 additions and 12 deletions
update tests
commit
1382ce6791
|
|
@ -1,8 +1,8 @@
|
|||
const {test} = require("supertape")
|
||||
const {threadToAnnouncement} = require("./thread-to-announcement")
|
||||
const { test } = require("supertape")
|
||||
const { threadToAnnouncement } = require("./thread-to-announcement")
|
||||
const data = require("../../../test/data")
|
||||
const Ty = require("../../types")
|
||||
const {mockGetEffectivePower} = require("../../matrix/utils.test")
|
||||
const { mockGetEffectivePower } = require("../../matrix/utils.test")
|
||||
|
||||
/**
|
||||
* @param {string} roomID
|
||||
|
|
@ -10,7 +10,7 @@ const {mockGetEffectivePower} = require("../../matrix/utils.test")
|
|||
* @returns {(roomID: string, eventID: string) => Promise<Ty.Event.Outer<Ty.Event.M_Room_Message>>}
|
||||
*/
|
||||
function mockGetEvent(t, roomID_in, eventID_in, outer) {
|
||||
return async function(roomID, eventID) {
|
||||
return async function (roomID, eventID) {
|
||||
t.equal(roomID, roomID_in)
|
||||
t.equal(eventID, eventID_in)
|
||||
return new Promise(resolve => {
|
||||
|
|
@ -35,8 +35,8 @@ const viaApi = {
|
|||
async getJoinedMembers(roomID) {
|
||||
return {
|
||||
joined: {
|
||||
"@_ooye_bot:cadence.moe": {display_name: null, avatar_url: null},
|
||||
"@user:matrix.org": {display_name: null, avatar_url: null}
|
||||
"@_ooye_bot:cadence.moe": { display_name: null, avatar_url: null },
|
||||
"@user:matrix.org": { display_name: null, avatar_url: null }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -46,7 +46,7 @@ test("thread2announcement: no known creator, no branched from event", async t =>
|
|||
const content = await threadToAnnouncement("!parent", "!thread", null, {
|
||||
name: "test thread",
|
||||
id: "-1"
|
||||
}, {api: viaApi})
|
||||
}, { api: viaApi })
|
||||
t.deepEqual(content, {
|
||||
msgtype: "m.text",
|
||||
body: "New thread started: \"test thread\" in room: https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org",
|
||||
|
|
@ -57,7 +57,7 @@ test("thread2announcement: known creator, no branched from event", async t => {
|
|||
const content = await threadToAnnouncement("!parent", "!thread", "@_ooye_crunch_god:cadence.moe", {
|
||||
name: "test thread",
|
||||
id: "-1"
|
||||
}, {api: viaApi})
|
||||
}, { api: viaApi })
|
||||
t.deepEqual(content, {
|
||||
msgtype: "m.emote",
|
||||
body: "started a thread called \"test thread\" in room: https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org",
|
||||
|
|
@ -83,7 +83,7 @@ test("thread2announcement: no known creator, branched from discord event", async
|
|||
})
|
||||
t.deepEqual(content, {
|
||||
msgtype: "m.text",
|
||||
body: "New thread started: \"test thread\" in room: https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org\n[Note: You really should continue the conversation in that room, rather than in this Matrix thread. Any messages sent here will be DELETED and instead moved there by the bot, which makes it the author and strips you from control (edits/deletions) over your own message!]",
|
||||
body: "New thread started: \"test thread\" in room: https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org\n[ YOU MUST continue the conversation in that thread-room, rather than in this Matrix thread, even if your client supports MX threads. Any messages sent in MX threads ARE !DELETED! and copied to thread-rooms, which makes OOYE the author, and strips you from edit/delete rights! ]",
|
||||
"m.relates_to": {
|
||||
"event_id": "$X16nfVks1wsrhq4E9SSLiqrf2N8KD0erD0scZG7U5xg",
|
||||
"is_falling_back": false,
|
||||
|
|
@ -114,7 +114,7 @@ test("thread2announcement: known creator, branched from discord event", async t
|
|||
})
|
||||
t.deepEqual(content, {
|
||||
msgtype: "m.emote",
|
||||
body: "started a thread called \"test thread\" in room: https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org\n[Note: You really should continue the conversation in that room, rather than in this Matrix thread. Any messages sent here will be DELETED and instead moved there by the bot, which makes it the author and strips you from control (edits/deletions) over your own message!]",
|
||||
body: "started a thread called \"test thread\" in room: https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org\n[ YOU MUST continue the conversation in that thread-room, rather than in this Matrix thread, even if your client supports MX threads. Any messages sent in MX threads ARE !DELETED! and copied to thread-rooms, which makes OOYE the author, and strips you from edit/delete rights! ]",
|
||||
"m.relates_to": {
|
||||
"event_id": "$X16nfVks1wsrhq4E9SSLiqrf2N8KD0erD0scZG7U5xg",
|
||||
"is_falling_back": false,
|
||||
|
|
@ -145,7 +145,7 @@ test("thread2announcement: no known creator, branched from matrix event", async
|
|||
})
|
||||
t.deepEqual(content, {
|
||||
msgtype: "m.text",
|
||||
body: "New thread started: \"test thread\" in room: https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org\n[Note: You really should continue the conversation in that room, rather than in this Matrix thread. Any messages sent here will be DELETED and instead moved there by the bot, which makes it the author and strips you from control (edits/deletions) over your own message!]",
|
||||
body: "New thread started: \"test thread\" in room: https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org\n[ YOU MUST continue the conversation in that thread-room, rather than in this Matrix thread, even if your client supports MX threads. Any messages sent in MX threads ARE !DELETED! and copied to thread-rooms, which makes OOYE the author, and strips you from edit/delete rights! ]",
|
||||
"m.mentions": {
|
||||
user_ids: ["@cadence:cadence.moe"]
|
||||
},
|
||||
|
|
@ -179,7 +179,7 @@ test("thread2announcement: known creator, branched from matrix event", async t =
|
|||
})
|
||||
t.deepEqual(content, {
|
||||
msgtype: "m.emote",
|
||||
body: "started a thread called \"test thread\" in room: https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org\n[Note: You really should continue the conversation in that room, rather than in this Matrix thread. Any messages sent here will be DELETED and instead moved there by the bot, which makes it the author and strips you from control (edits/deletions) over your own message!]",
|
||||
body: "started a thread called \"test thread\" in room: https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org\n[ YOU MUST continue the conversation in that thread-room, rather than in this Matrix thread, even if your client supports MX threads. Any messages sent in MX threads ARE !DELETED! and copied to thread-rooms, which makes OOYE the author, and strips you from edit/delete rights! ]",
|
||||
"m.mentions": {
|
||||
user_ids: ["@cadence:cadence.moe"]
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue