Files
meteor/packages/tinytest/tinytest_server.js
Geoff Schmidt 3dc8dc2887 Permit fine-grained control of database polling.
You can now used invalidation keys to specify exactly what will get polled when.
2012-03-06 15:44:42 -08:00

26 lines
728 B
JavaScript

Meteor.startup(function () {
Meteor._ServerTestResults.remove();
});
App.publish('tinytest/results', function (run_id) {
return Meteor._ServerTestResults.find({run_id: run_id},
{key: {collection: 'tinytest_results',
run_id: run_id}});
});
App.methods({
'tinytest/run': function (run_id) {
var request = this;
request.beginAsync();
Meteor._runTests(function (report) {
/* onReport */
Meteor._ServerTestResults.insert({run_id: run_id, report: report});
Meteor.refresh({collection: 'tinytest_results', run_id: run_id});
}, function () {
/* onComplete */
request.respond();
});
}
});