add test for member state content
This commit is contained in:
parent
d70199f890
commit
cc1210729f
3 changed files with 70 additions and 0 deletions
|
@ -154,6 +154,7 @@ async function syncAllUsersInRoom(roomID) {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports._memberToStateContent = memberToStateContent
|
||||
module.exports.ensureSim = ensureSim
|
||||
module.exports.ensureSimJoined = ensureSimJoined
|
||||
module.exports.syncUser = syncUser
|
||||
|
|
24
d2m/actions/register-user.test.js
Normal file
24
d2m/actions/register-user.test.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
const {channelToKState} = require("./create-room")
|
||||
const {_memberToStateContent} = require("./register-user")
|
||||
const {test} = require("supertape")
|
||||
const testData = require("../../test/data")
|
||||
|
||||
test("member2state: general", async t => {
|
||||
t.deepEqual(
|
||||
await _memberToStateContent(testData.member.sheep.user, testData.member.sheep, testData.guild.general.id),
|
||||
{
|
||||
avatar_url: "mxc://cadence.moe/rfemHmAtcprjLEiPiEuzPhpl",
|
||||
displayname: "The Expert's Submarine | aprilsong",
|
||||
membership: "join",
|
||||
"moe.cadence.ooye.member": {
|
||||
avatar: "/guilds/112760669178241024/users/134826546694193153/avatars/38dd359aa12bcd52dd3164126c587f8c.png?size=1024"
|
||||
},
|
||||
"uk.half-shot.discord.member": {
|
||||
bot: false,
|
||||
displayColor: null,
|
||||
id: "134826546694193153",
|
||||
username: "@aprilsong"
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
45
test/data.js
45
test/data.js
|
@ -93,6 +93,51 @@ module.exports = {
|
|||
system_channel_flags: 0|0
|
||||
}
|
||||
},
|
||||
member: {
|
||||
sheep: {
|
||||
avatar: "38dd359aa12bcd52dd3164126c587f8c",
|
||||
communication_disabled_until: null,
|
||||
flags: 0,
|
||||
joined_at: "2020-10-14T22:08:37.804000+00:00",
|
||||
nick: "The Expert's Submarine",
|
||||
pending: false,
|
||||
premium_since: "2022-05-04T00:28:44.326000+00:00",
|
||||
roles: [
|
||||
"112767366235959296", "118924814567211009",
|
||||
"118923488755974146", "199995902742626304",
|
||||
"204427286542417920", "217013981053845504",
|
||||
"222168467627835392", "260993819204386816",
|
||||
"265239342648131584", "271173313575780353",
|
||||
"225744901915148298", "287733611912757249",
|
||||
"318243902521868288", "348651574924541953",
|
||||
"352291384021090304", "378402925128712193",
|
||||
"392141548932038658", "393912152173576203",
|
||||
"1123460940935991296", "872274377150980116",
|
||||
"373336013109461013", "530220455085473813",
|
||||
"768280323829137430", "842343433452257310",
|
||||
"454567553738473472", "920107226528612383",
|
||||
"1123528381514911745", "1040735082610167858",
|
||||
"585531096071012409", "849737964090556488",
|
||||
"660272211449479249"
|
||||
],
|
||||
user: {
|
||||
id: "134826546694193153",
|
||||
username: "aprilsong",
|
||||
avatar: "c754c120bce07ae3b3130e2b0e61d9dd",
|
||||
discriminator: "0",
|
||||
public_flags: 640,
|
||||
flags: 640,
|
||||
banner: "a3ad0693213f9dbf793b4159dbae0717",
|
||||
accent_color: null,
|
||||
global_name: "sheep",
|
||||
avatar_decoration: null,
|
||||
display_name: "sheep",
|
||||
banner_color: null
|
||||
},
|
||||
mute: false,
|
||||
deaf: false
|
||||
}
|
||||
},
|
||||
message: {
|
||||
// Display order is text content, attachments, then stickers
|
||||
sticker: {
|
||||
|
|
Loading…
Reference in a new issue