tests: api.mocha.coffee cleanup WIP

This commit is contained in:
Tyler Renelle
2014-01-03 10:26:46 -07:00
parent 2c1eb955ac
commit 6d8e4ed8a2
2 changed files with 68 additions and 74 deletions
+2 -1
View File
@@ -423,6 +423,7 @@ _.each(shared.wrap({}).ops, function(op,k){
------------------------------------------------------------------------
*/
api.batchUpdate = function(req, res, next) {
if (_.isEmpty(req.body)) req.body = []; // cases of {} or null
if (req.body[0] && req.body[0].data)
return res.json(400, {err: "API has been updated, please refresh your browser or upgrade your mobile app."})
@@ -441,7 +442,7 @@ api.batchUpdate = function(req, res, next) {
};
// Setup the array of functions we're going to call in parallel with async
var ops = _.transform(req.body || [], function(result, _req) {
var ops = _.transform(req.body, function(result, _req) {
if (!_.isEmpty(_req)) {
result.push(function(cb) {
callOp(_req, cb);