mirror of
https://github.com/harish2704/simple-mocha.git
synced 2026-09-10 06:21:08 +00:00
Tests for afterEach and beforeEach function
This commit is contained in:
+16
-1
@@ -1,4 +1,4 @@
|
|||||||
/* globals describe, it, before, after */
|
/* globals describe, it, before, after, beforeEach, afterEach */
|
||||||
|
|
||||||
var messageLog = [];
|
var messageLog = [];
|
||||||
var pr = function( msg ){
|
var pr = function( msg ){
|
||||||
@@ -48,9 +48,24 @@ var afterFn = asyncFn({
|
|||||||
error: null,
|
error: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var beforeEachFn = asyncFn({
|
||||||
|
msg: 'BeforeEach_block',
|
||||||
|
delay: 5,
|
||||||
|
error: null
|
||||||
|
});
|
||||||
|
|
||||||
|
var afterEachFn = asyncFn({
|
||||||
|
msg: 'AfterEach_block',
|
||||||
|
delay: 5,
|
||||||
|
error: null
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
describe( 'describe', function(){
|
describe( 'describe', function(){
|
||||||
|
|
||||||
before( beforeFn );
|
before( beforeFn );
|
||||||
|
beforeEach( beforeEachFn );
|
||||||
|
afterEach( afterEachFn );
|
||||||
it( 'it1', it1 );
|
it( 'it1', it1 );
|
||||||
it( 'it2', it2 );
|
it( 'it2', it2 );
|
||||||
after( afterFn );
|
after( afterFn );
|
||||||
|
|||||||
@@ -52,6 +52,14 @@ describe( 'Simple before block + it s ', function(){
|
|||||||
assert( firsDescribeBlock.afterFn );
|
assert( firsDescribeBlock.afterFn );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it( 'should parse beforeEach block', function(){
|
||||||
|
assert( firsDescribeBlock.beforeEachFn );
|
||||||
|
})
|
||||||
|
|
||||||
|
it( 'should parse afterEach block', function(){
|
||||||
|
assert( firsDescribeBlock.afterEachFn );
|
||||||
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user