From the course: Learning End-to-End Testing with Jest

Unlock this course with a free trial

Join today to access over 25,600 courses taught by industry experts.

Finish up on Login endpoint test

Finish up on Login endpoint test

- [Instructor] Four running negative tests on the login endpoints. The first case is when to use or leave the password field empty. This description is, do not sign him in, password field can not be empty. Define the inputs. In this case, we define only the username, no password. Username is admin. Call the login endpoints and send the inputs. Expected statusCode is 400. Expected response body is an objectContaining success false and message username or password can not be empty. Server run test. Two tests passed, our coverage is 51.45%. The second case of negative testing is when to use or leave the username field empty. Description is, do not sign him in, username field can not be empty. Define the inputs, only the password this time. Password is okay. Call the login endpoints and send the inputs. Expected statusCode is 400 and expected response body is an objectContaining success false and message…

Contents