Question · JavaScript and TypeScript course · Module 11: Testing with Jest

The .toHaveBeenCalledWith() Matcher

What does the .toHaveBeenCalledWith() matcher do in Jest?

Answer options

  • Checks whether the mock function has been reset
  • Checks whether the mock function returned a specific value
  • Checks what arguments the mock function was called with
  • Checks how many times the mock function was called

You can check the correct answer by solving this task in the CodeWorlds game.