Created
September 29, 2011 16:52
-
-
Save mandric/1251252 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports['clinic totals'] = function(test) { | |
var args = { group_level: 1 }; | |
var sum = function(data) { | |
var t = 0; | |
for (var i in data.rows) { | |
t += data.rows[i].value; | |
} | |
return t; | |
}; | |
db.getView('total_clinics_by_clinic', args, function (err, data) { | |
var total1 = sum(data); | |
db.getView('total_clinics_by_district_hospital', args, function (err, data) { | |
var total2 = sum(data); | |
test.same(total1, total2); | |
db.getView('total_clinics_by_health_center', args, function (err, data) { | |
var total3 = sum(data); | |
test.same(total2, total3); | |
test.done(); | |
}); | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment