TripAPI.get('/:tripId/users', function(request, response) { var tripId = request.params.tripId; User.allOfTrip(tripId) .then(sendStatusAndData(response, 200)) .catch(sendStatusAndError('Server error getting users by trip id')) })
it_('should list no tasks for a trip that does not exist', function * () { yield Task.allOfTrip(404) .then(function(tasks) { expect(tasks).to.have.length(0); }) .catch(reportError('listing tasks from invalid tripId')); })
TripAPI.get('/:tripId/tasks', function(request, response) { var tripId = request.params.tripId; Task.allOfTrip(tripId) .then(sendStatusAndData(response, 200)) .catch(sendStatusAndError(response, 500, 'Server error getting tasks by trip id')) })
it_('should list all tasks of a trip', function * () { yield Task.allOfTrip(2) .then(function(tasks) { expect(tasks).to.have.length(2); expect(tasks[0].name).to.equal('Places to sink'); }) .catch(reportError('listing tasks from trip by id')); })