☕️ Classic, reliable, trusted test framework for Node.js and the browser
refactored grep tests
TJ Holowaychukacd161c5d83e
diff --git a/test/grep.js b/test/grep.jsnew file mode 100644index 00000000..47b879dc--- /dev/null+++ b/test/grep.js@@ -0,0 +1,35 @@++var Mocha = require('../');++describe('Mocha', function(){+ describe('"grep" option', function(){+ it('should add a RegExp to the mocha.options object', function(){+ var mocha = new Mocha({ grep: /foo/ });+ mocha.options.grep.toString().should.equal('/foo/');+ })++ it('should convert grep string to a RegExp', function(){+ var mocha = new Mocha({ grep: 'foo' });+ mocha.options.grep.toString().should.equal('/foo/');+ })+ })++ describe('.grep()', function(){+ it('should add a RegExp to the mocha.options object', function(){+ var mocha = new Mocha;+ mocha.grep(/foo/);+ mocha.options.grep.toString().should.equal('/foo/');+ })++ it('should convert grep string to a RegExp', function(){+ var mocha = new Mocha;+ mocha.grep('foo');+ mocha.options.grep.toString().should.equal('/foo/');+ })++ it('should return it\'s parent Mocha object for chainability', function(){+ var mocha = new Mocha;+ mocha.grep().should.equal(mocha);+ })+ })+})diff --git a/test/jsapi/grep.js b/test/jsapi/grep.jsdeleted file mode 100644index f93cb909..00000000--- a/test/jsapi/grep.js+++ /dev/null@@ -1,44 +0,0 @@-var Mocha = require('../../');--describe('Mocha', function(){-- beforeEach(function(){- this.reEqual = function(r1, r2){- return r1.source === r2.source- && r1.global === r2.global- && r1.ignoreCase === r2.ignoreCase- && r1.multiline === r2.multiline;- }- })-- describe('constructor options.grep', function(){- it('should add a RegExp to the mocha.options object', function(){- var mocha = new Mocha({grep:/foo/});- this.reEqual(/foo/, mocha.options.grep).should.be.ok;- })-- it('should convert grep string to a RegExp', function(){- var mocha = new Mocha({grep:'foo'});- this.reEqual(/foo/, mocha.options.grep).should.be.ok;- })- })-- describe('.grep()', function(){- it('should add a RegExp to the mocha.options object', function(){- var mocha = new Mocha();- mocha.grep(/foo/);- this.reEqual(/foo/, mocha.options.grep).should.be.ok;- })-- it('should convert grep string to a RegExp', function(){- var mocha = new Mocha();- mocha.grep('foo');- this.reEqual(/foo/, mocha.options.grep).should.be.ok;- })-- it('should return it\'s parent Mocha object for chainability', function(){- var mocha = new Mocha();- mocha.grep().should.equal(mocha);- })- })-})