Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

another test

Tj Holowaychuk6c40e997b1dd
diff --git a/test/runnable.js b/test/runnable.js
index 8d33bb11..55a2c66e 100644
--- a/test/runnable.js
+++ b/test/runnable.js
@@ -50,7 +50,7 @@ describe('Runnable(title, fn)', function(){
})
})
- describe('when throwing an exception', function(){
+ describe('when an exception is thrown', function(){
it('should invoke the callback', function(done){
var calls = 0;
var test = new Runnable('foo', function(){
@@ -66,5 +66,34 @@ describe('Runnable(title, fn)', function(){
})
})
})
+
+ describe('when async', function(){
+ describe('without error', function(){
+ it('should invoke the callback', function(done){
+ var calls = 0;
+ var test = new Runnable('foo', function(done){
+ process.nextTick(done);
+ });
+
+ test.run(done);
+ })
+ })
+
+ describe('when an exception is thrown', function(){
+ it('should invoke the callback', function(done){
+ var calls = 0;
+ var test = new Runnable('foo', function(done){
+ throw new Error('fail');
+ process.nextTick(done);
+ });
+
+ test.run(function(err){
+ err.message.should.equal('fail');
+ done();
+ });
+ })
+ })
+ })
+
})
})
\ No newline at end of file