Browse Source

Cleanup tests

refactor
Harish.K 10 years ago
parent
commit
75d79358b6
  1. 3
      index-v1.js
  2. 24
      test/simple-mocha.spec.js

3
index-v1.js

@ -1,5 +1,6 @@
var _d = console.log.bind( console, 'dbg: ' );
// var _d = console.log.bind( console, 'dbg: ' );
var _d = function(){};
var fs = require('fs'); var fs = require('fs');
function DescribeBlock( parentBlock ){ function DescribeBlock( parentBlock ){

24
test/simple-mocha.spec.js

@ -7,24 +7,32 @@ var assert = require('assert');
describe( 'Simple before block + it s ', function(){ describe( 'Simple before block + it s ', function(){
it( 'should parse simple test file' , function( done ){
describe( 'should parse simple test file' , function(){
var runner = SimpleMocha.load( __dirname + '/data/dummy.spec.js' ); var runner = SimpleMocha.load( __dirname + '/data/dummy.spec.js' );
assert( runner );
it( 'should load', function(){
assert( runner );
})
var describeBlock = runner.rootDescribeBlock; var describeBlock = runner.rootDescribeBlock;
assert( describeBlock );
assert( describeBlock instanceof SimpleMocha.DescribeBlock );
assert.equal( describeBlock.children.length, 1 );
it( 'should have a root describe block', function(){
assert( describeBlock );
assert( describeBlock instanceof SimpleMocha.DescribeBlock );
assert.equal( describeBlock.children.length, 1 );
});
var firsDescribeBlock = describeBlock.children[0]; var firsDescribeBlock = describeBlock.children[0];
assert( firsDescribeBlock instanceof SimpleMocha.DescribeBlock );
assert( firsDescribeBlock.beforeFn );
it( 'rootDescribeBlock should have child blocks', function(){
assert( firsDescribeBlock instanceof SimpleMocha.DescribeBlock );
});
it( 'child describeBlock should parse before hook', function(){
assert( firsDescribeBlock.beforeFn );
});
done();
}); });
}) })

Loading…
Cancel
Save