Files
meteor/packages/tinytest/tinytest_server.js
2012-02-29 16:08:59 -08:00

26 lines
626 B
JavaScript

Meteor.startup(function () {
Meteor._ServerTestResults.remove();
});
App.publish('tinytest/results', function (sub, params) {
return Meteor._ServerTestResults.find({run_id: params.run_id});
});
App.methods({
'tinytest/run': function (run_id) {
var request = this;
request.beginAsync();
var reportFunc = function (report) {
Meteor._ServerTestResults.insert({run_id: run_id, report: report});
};
var testRun = Meteor._TestManager.createRun(reportFunc);
test._currentRun.withValue(testRun, function () {
testRun.run(function () {
request.respond();
});
});
}
});