Put in order · NestJS course · Module 7: Testing

The mockReturnValue method

Arrange mocking variants from synchronous to asynchronous:

Items to put in order

  • mockReturnValueOnce() - returns a value only once
  • mockResolvedValue() - returns a resolved Promise
  • mockRejectedValue() - returns a rejected Promise
  • mockReturnValue() - returns a value synchronously

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