|
@@ -0,0 +1,24 @@
|
|
|
+
|
|
|
+Tinytest.add('Errors - collection', function (test) {
|
|
|
+ // Collection is local, hence empty on start.
|
|
|
+ test.equal(Errors.collection.find({}).count(), 0);
|
|
|
+
|
|
|
+ Errors.throw('A new error');
|
|
|
+ test.equal(Errors.collection.find({}).count(), 1);
|
|
|
+
|
|
|
+ Errors.collection.remove({});
|
|
|
+});
|
|
|
+
|
|
|
+Tinytest.addAsync('Errors - template', function (test, done) {
|
|
|
+ Errors.throw('A new error');
|
|
|
+ test.equal(Errors.collection.find({}).count(), 1);
|
|
|
+
|
|
|
+ // Render the template.
|
|
|
+ UI.insert(UI.render(Template.meteorErrors), document.body);
|
|
|
+
|
|
|
+ // Make sure the error collection is emptied after
|
|
|
+ Meteor.setTimeout(function () {
|
|
|
+ test.equal(Errors.collection.find({}).count(), 0);
|
|
|
+ done();
|
|
|
+ }, Errors.delay + 200);
|
|
|
+});
|