I am having this issue with Jest. I use a mock function and its calls are not getting counted within the forEach loop. However, in a for loop, everything is working well...
async function resetRoles(supabase, discord) {
discord.guilds.cache.forEach(async (guild) => {
const guild_data = await supabase.fetchGuild(guild.id, discord.application.id)
const role_manager = guild.roles.cache.find((role) => role.name == guild_data[0].role);
});
}
Obvisouly, I cannot use a for loop.