Going through the tests I wasn't sure which id this function was referring to, team_id or player_id. If it is referring to playerid, then it should be returning the player with resolve(data.rows[0]);_ instead of an array.
/**
* Returns a promise that contains an array of the players with the requested id
* @param id
* @returns {Promise}
*/
exports.getPlayersById = function(id){
return new Promise(function(resolve, reject){
DatabaseController.query("SELECT * from players WHERE id = $1", [id]).then(function(data){
resolve(data.rows);
});
});
}
Going through the tests I wasn't sure which id this function was referring to, team_id or player_id. If it is referring to playerid, then it should be returning the player with resolve(data.rows[0]);_ instead of an array.