-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors_tests.js
More file actions
25 lines (22 loc) · 782 Bytes
/
Copy patherrors_tests.js
File metadata and controls
25 lines (22 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Tinytest.add("Errors collection works", function(test) {
test.equal(Meteor.errors.find({}).count(),0);
Meteor.Errors.throw('A new error!');
test.equal(Meteor.errors.find({}).count(),1);
Meteor.errors.remove({});
});
Tinytest.addAsync("Errors template works",function(test,done) {
Meteor.Errors.throw('A new error!');
test.equal(Meteor.errors.find({seen:false}).count(),1);
// render the template
OnscreenDiv(Spark.render(function() {
return Template.meteorErrors();
}));
// wait a few milliseconds
Meteor.setTimeout(function() {
test.equal(Meteor.errors.find({seen: false}).count(),0);
test.equal(Meteor.errors.find({}).count(),1);
Meteor.Errors.clear();
test.equal(Meteor.errors.find({seen: true}).count(),0);
done();
},500);
});