Click in order · NestJS course · Module 7: Testing

rejects.toThrow syntax

Arrange the assertion testing a rejected Promise:

Items to click

  • ).rejects
  • service.findById(999)
  • await expect(
  • .toThrow(NotFoundException)

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