Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Allows writing lint-friendly tests" #306

Merged
merged 1 commit into from
Nov 13, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions lib/chai/assertion.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

var config = require('./config');
var NOOP = function() { };

module.exports = function (_chai, util) {
/*!
Expand Down Expand Up @@ -70,10 +69,6 @@ module.exports = function (_chai, util) {
util.addChainableMethod(this.prototype, name, fn, chainingBehavior);
};

Assertion.addChainableNoop = function(name, fn) {
util.addChainableMethod(this.prototype, name, NOOP, fn);
};

Assertion.overwriteProperty = function (name, fn) {
util.overwriteProperty(this.prototype, name, fn);
};
Expand Down
52 changes: 9 additions & 43 deletions lib/chai/core/assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,11 @@ module.exports = function (chai, _) {
* expect(undefined).to.not.be.ok;
* expect(null).to.not.be.ok;
*
* Can also be used as a function, which prevents some linter errors.
*
* expect('everthing').to.be.ok();
*
* @name ok
* @api public
*/

Assertion.addChainableNoop('ok', function () {
Assertion.addProperty('ok', function () {
this.assert(
flag(this, 'object')
, 'expected #{this} to be truthy'
Expand All @@ -209,15 +205,11 @@ module.exports = function (chai, _) {
* expect(true).to.be.true;
* expect(1).to.not.be.true;
*
* Can also be used as a function, which prevents some linter errors.
*
* expect(true).to.be.true();
*
* @name true
* @api public
*/

Assertion.addChainableNoop('true', function () {
Assertion.addProperty('true', function () {
this.assert(
true === flag(this, 'object')
, 'expected #{this} to be true'
Expand All @@ -234,15 +226,11 @@ module.exports = function (chai, _) {
* expect(false).to.be.false;
* expect(0).to.not.be.false;
*
* Can also be used as a function, which prevents some linter errors.
*
* expect(false).to.be.false();
*
* @name false
* @api public
*/

Assertion.addChainableNoop('false', function () {
Assertion.addProperty('false', function () {
this.assert(
false === flag(this, 'object')
, 'expected #{this} to be false'
Expand All @@ -259,15 +247,11 @@ module.exports = function (chai, _) {
* expect(null).to.be.null;
* expect(undefined).not.to.be.null;
*
* Can also be used as a function, which prevents some linter errors.
*
* expect(null).to.be.null();
*
* @name null
* @api public
*/

Assertion.addChainableNoop('null', function () {
Assertion.addProperty('null', function () {
this.assert(
null === flag(this, 'object')
, 'expected #{this} to be null'
Expand All @@ -283,15 +267,11 @@ module.exports = function (chai, _) {
* expect(undefined).to.be.undefined;
* expect(null).to.not.be.undefined;
*
* Can also be used as a function, which prevents some linter errors.
*
* expect(undefined).to.be.undefined();
*
* @name undefined
* @api public
*/

Assertion.addChainableNoop('undefined', function () {
Assertion.addProperty('undefined', function () {
this.assert(
undefined === flag(this, 'object')
, 'expected #{this} to be undefined'
Expand All @@ -312,15 +292,11 @@ module.exports = function (chai, _) {
* expect(bar).to.not.exist;
* expect(baz).to.not.exist;
*
* Can also be used as a function, which prevents some linter errors.
*
* expect(foo).to.exist();
*
* @name exist
* @api public
*/

Assertion.addChainableNoop('exist', function () {
Assertion.addProperty('exist', function () {
this.assert(
null != flag(this, 'object')
, 'expected #{this} to exist'
Expand All @@ -340,15 +316,11 @@ module.exports = function (chai, _) {
* expect('').to.be.empty;
* expect({}).to.be.empty;
*
* Can also be used as a function, which prevents some linter errors.
*
* expect([]).to.be.empty();
*
* @name empty
* @api public
*/

Assertion.addChainableNoop('empty', function () {
Assertion.addProperty('empty', function () {
var obj = flag(this, 'object')
, expected = obj;

Expand All @@ -374,12 +346,6 @@ module.exports = function (chai, _) {
* expect(arguments).to.be.arguments;
* }
*
* Can also be used as a function, which prevents some linter errors.
*
* function test () {
* expect(arguments).to.be.arguments();
* }
*
* @name arguments
* @alias Arguments
* @api public
Expand All @@ -395,8 +361,8 @@ module.exports = function (chai, _) {
);
}

Assertion.addChainableNoop('arguments', checkArguments);
Assertion.addChainableNoop('Arguments', checkArguments);
Assertion.addProperty('arguments', checkArguments);
Assertion.addProperty('Arguments', checkArguments);

/**
* ### .equal(value)
Expand Down
32 changes: 0 additions & 32 deletions test/expect.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ describe('expect', function () {
expect(false).to.not.be.true;
expect(1).to.not.be.true;

expect(true).to.be.true();
expect(true).to.be.true().and.not.false;
expect(true).to.be.true.and.not.false();

err(function(){
expect('test').to.be.true;
}, "expected 'test' to be true")
Expand All @@ -30,10 +26,6 @@ describe('expect', function () {
expect(1).to.be.ok;
expect(0).to.not.be.ok;

expect(true).to.be.ok();
expect(true).to.be.ok().and.not.false;
expect(true).to.be.ok.and.not.false();

err(function(){
expect('').to.be.ok;
}, "expected '' to be truthy");
Expand All @@ -48,10 +40,6 @@ describe('expect', function () {
expect(true).to.not.be.false;
expect(0).to.not.be.false;

expect(false).to.be.false();
expect(false).to.be.false().and.not.true;
expect(false).to.be.false.and.not.true();

err(function(){
expect('').to.be.false;
}, "expected '' to be false")
Expand All @@ -61,10 +49,6 @@ describe('expect', function () {
expect(null).to.be.null;
expect(false).to.not.be.null;

expect(null).to.be.null();
expect(null).to.be.null().and.not.ok();
expect(null).to.be.null.and.not.ok();

err(function(){
expect('').to.be.null;
}, "expected '' to be null")
Expand All @@ -75,10 +59,6 @@ describe('expect', function () {
expect(undefined).to.be.undefined;
expect(null).to.not.be.undefined;

expect(undefined).to.be.undefined();
expect(undefined).to.be.undefined().and.not.ok();
expect(undefined).to.be.undefined.and.not.ok();

err(function(){
expect('').to.be.undefined;
}, "expected '' to be undefined")
Expand All @@ -89,10 +69,6 @@ describe('expect', function () {
, bar;
expect(foo).to.exist;
expect(bar).to.not.exist;

expect(foo).to.exist();
expect(foo).to.exist().and.contain('bar');
expect(foo).to.exist.and.contain('bar');
});

it('arguments', function(){
Expand All @@ -101,10 +77,6 @@ describe('expect', function () {
expect([]).to.not.be.arguments;
expect(args).to.be.an('arguments').and.be.arguments;
expect([]).to.be.an('array').and.not.be.Arguments;

expect(args).to.be.Arguments();
expect(args).to.be.arguments().and.be.ok;
expect(args).to.be.arguments.and.be.ok();
});

it('.equal()', function(){
Expand Down Expand Up @@ -383,10 +355,6 @@ describe('expect', function () {
expect({}).to.be.empty;
expect({foo: 'bar'}).not.to.be.empty;

expect('').to.be.empty();
expect('').to.be.empty().and.exist;
expect('').to.be.empty.and.exist;

err(function(){
expect('').not.to.be.empty;
}, "expected \'\' not to be empty");
Expand Down