const
	Parser  	= require('../lib/parser'),
	expect		= require('chai').expect,
	esprima		= require('esprima'),
	r			= require('remove-tabs'),
	util		= require('util'),
	$			= require('esquery'),
	diff		= require('deep-diff').diff;
	
	
describe('BluePrintParser', function(){
	it('should throw an error if there is a line which has indents gap more than 2.', function(){
	    var blueprint = r`
			DESCRIBE: Lines
					InIT: should not have gap more than 2.`;
		
		expect(Parser.parse.bind(null, blueprint)).to.throw(Error, 'Invalid indent.');
	});
	
	
	it('should throw an error if there is a line which has no key.', function(){
		var blueprint =	r`
			DESCRIBE: Lines
				should have a key not like me.`;
						
		expect(Parser.parse.bind(null, blueprint)).to.throw(Error, 'Invalid line.');
	});
    
    
    it('should throw an error if there is a line which has empty key.', function() {
    	var blueprint =	r`
    		DESCRIBE: Lines
				:should not have a empty key not like me.`;
						
		expect(Parser.parse.bind(null, blueprint)).to.throw(Error, 'Invalid line.');
    });
    
    
    it('should ignore a comment which has leading #.', function(){
    	var blueprint = r`
    		DESCRIBE: Comment
				# should ignore!`;
    	
    	var outline = Parser.parse(blueprint);
    	var block = $(outline, 'CallExpression BlockStatement');
    	
    	expect(block[0].body).to.have.length(0);
    });
    
    
    it('should return a correct object if a line which has empty value.', function(){
    	var blueprint = r`
			DESCRIBE: Line
				IT: should be able to have empty value.
				IT: `;
    		
    	var outline = Parser.parse(blueprint);
    	var block = $(outline, 'CallExpression BlockStatement');
    	
    	expect(block[0].body).to.have.length(2);
    });
    
    
    it('should return a correct object if a valid blueprint is given.', function(){
    	
    	var blueprint = [ 
			r`
			DESCRIBE: Parser
	    		CONTEXT: when a valid blueprint is given,
					IT: should pass a test spec.`,
    		r`
			DESCRIBE: Parent
				CONTEXT: can have many
				CONTEXT: children`
    	];
    	
    	var expected = [
    		esprima.parse(r`
				describe('Parser', function() {
					context('when a valid blueprint is given,', function() {
						it('should pass a test spec.', function() {
						});
					});
				});`
    		),
	    	esprima.parse(r`
				describe('Parent', function() {
					context('can have many', function() {
					});
					context('children', function(){
					});
				});`
    		)
    	];
    	
    	for(var i = 0 ; i < blueprint.length ; i++) {
    		var outline 	= Parser.parse(blueprint[i]);
    		
    		expect(diff(outline, expected[i])).to.be.undefined;
    	}
    });
});
@@ -1169,19 +1169,28 @@
 lueprint
+s
  = 
+%5B%0A    %09%09
 r%60%0A    %09
@@ -1229,28 +1229,207 @@
 ignore!%60
-;%0A    %09%0A    
+,%0A%09%09%09%09%0A%09%09%09r%60%0A%09%09%09DESCRIBE: Comment%0A%09%09%09%09# should ignore%0A%09%09%09%09CONTEXT: should not ignore.%60%0A%09%09%5D;%0A%09%09%0A    %09%0A    %09var lengths = %5B0, 1%5D;%0A    %09%0A    %09for(var i = 0 ; i %3C blueprints.length ; i++) %7B%0A    %09
 %09var out
@@ -1453,32 +1453,36 @@
 se(blueprint
+s%5Bi%5D
 );%0A    %09
 var block = 
@@ -1461,32 +1461,40 @@
 rints%5Bi%5D);%0A    %09
+%09%0A    %09%09
 var block = $(ou
@@ -1531,33 +1531,35 @@
 atement');%0A    %09
-%0A
+%09%0A%09
     %09expect(bloc
@@ -1588,11 +1588,27 @@
 gth(
-0);
+lengths%5Bi%5D);%0A    %09%7D
 %0A   

Apply remove-tabs module.