Closed bfwalton closed 7 years ago
The tests for now were just testing to make sure the function was returning a value other than null. They were just set up for future testing purposes, more assertions can be added.
I know the database may not be up and running yet but if it is there is trouble connecting to it. I have added the create player before the tests and the controller does not correctly add the player to the database and instead returns this error from the database controller:
Debugger listening on port 15454 /home/ubuntu/workspace/BaseballSim/Controller/DatabaseController.js:9 client.query(query, args, function(err, result){ ^
TypeError: Cannot read property 'query' of null
at /home/ubuntu/workspace/BaseballSim/Controller/DatabaseController.js:9:22
at null.
Process exited with code: 1
Hey,
I looked into the issue. This issue occurs when it cannot connect to a Postgres server. The way I've been testing is having a postgres server running on my personal machine. I added code to display a less generic error message instead.
The tests are testing to see if a promise is null instead of checking the promise value to see if its returning the correct data. Is this intended?
Also testing with the id's in the database may not be the best way since it will fail every time after the first test, specifically the delete test