YCPCS-481-TeamB / BaseballSim

CS481 Group Project
0 stars 0 forks source link

Test issues #8

Closed bfwalton closed 7 years ago

bfwalton commented 7 years ago

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

koopaluigi commented 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. (/home/ubuntu/workspace/BaseballSim/node_modules/pg/node_modules/pg-pool/index.js:62:11) at /home/ubuntu/workspace/BaseballSim/node_modules/pg/node_modules/pg-pool/node_modules/generic-pool/lib/generic-pool.js:339:9 at null. (/home/ubuntu/workspace/BaseballSim/node_modules/pg/node_modules/pg-pool/index.js:45:7) at null. (/home/ubuntu/workspace/BaseballSim/node_modules/pg/lib/client.js:185:5) at emitOne (events.js:77:13) at emit (events.js:169:7) at Socket. (/home/ubuntu/workspace/BaseballSim/node_modules/pg/lib/connection.js:71:10) at emitOne (events.js:77:13) at Socket.emit (events.js:169:7)

Process exited with code: 1

bfwalton commented 7 years ago

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.