Testing for failure (404 Response)


#1

I’m trying to write a test for failure in our app, but can’t seem to find out why I keep getting the following stack trace in Qunit:

{error: invalid_request, error_description: 'password' required.}@ 230 ms
Expected: 	
true
Result:
false
Diff: 	
true false 
Source: 	
    at http://fly.dev/assets/test-support.js:4217:13

The test is simple. If the user enters does not enter in a password, return a 404 with an object that contains the error message:

tokenRouter.post('/', function(req, res) {
  if (!req.body.password) {    
    res.status(404).send({"error":"invalid_request","error_description":"'password' required."});
    return;
  }
  ... More checks after this ...
});

Not sure what to do here?