Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

341
Views
Jest mock function not getting counted in forEach loop (but does in for...of loop)

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.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!