mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-15 10:58:16 +00:00
fix: improve unit tests style
This commit is contained in:
@@ -35,32 +35,5 @@ export async function removeRoleTest(
|
||||
options: { reason?: string },
|
||||
t: Deno.TestContext
|
||||
) {
|
||||
const role = await bot.helpers.createRole(guildId, {
|
||||
name: "hoti",
|
||||
});
|
||||
|
||||
assertExists(role);
|
||||
|
||||
// Delay the execution to allow event to be processed
|
||||
await delayUntil(10000, () => bot.cache.guilds.get(guildId)?.roles.has(role.id));
|
||||
|
||||
assertExists(bot.cache.guilds.get(guildId)?.roles.has(role.id));
|
||||
|
||||
bot.events.guildMemberUpdate = function (bot, member, user) {
|
||||
roleChanges.set(user.id, member.roles);
|
||||
};
|
||||
|
||||
await bot.helpers.addRole(guildId, bot.id, role.id, options.reason);
|
||||
|
||||
// Delay the execution to allow event to be processed
|
||||
await delayUntil(10000, () => roleChanges.get(bot.id)?.includes(role.id));
|
||||
|
||||
assertEquals(roleChanges.get(bot.id)?.includes(role.id), true);
|
||||
|
||||
await bot.helpers.removeRole(guildId, bot.id, role.id, options.reason);
|
||||
|
||||
// Delay the execution to allow event to be processed
|
||||
await delayUntil(10000, () => !roleChanges.get(bot.id)?.includes(role.id));
|
||||
|
||||
assertEquals(roleChanges.get(bot.id)?.includes(role.id), false);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user