Search⌘ K
AI Features

Unit Testing for the Invalid Password Scenario During Sign-In

Explore writing unit tests for the invalid password scenario in NestJS authentication. Learn to mock repository behavior and bcrypt password checks, ensuring the signIn method throws the correct UnauthorizedException for incorrect passwords.

Test: Invalid password

  • Objective: To ensure the signIn method properly handles cases where a user attempts to sign in with an existing email in our system but an incorrect password.

Key points to test:

  • The function should throw ...