Skip to content

Commit

Permalink
Merge pull request #538 from tusbar/tusbar/revert-499
Browse files Browse the repository at this point in the history
Revert .empty assertion change from PR #499
  • Loading branch information
keithamus committed Oct 21, 2015
2 parents 6472cb9 + 8c1d8cf commit 1b2c648
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/chai/core/assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,17 @@ module.exports = function (chai, _) {
*/

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

if (Array.isArray(obj) || 'string' === typeof object) {
expected = obj.length;
} else if (typeof obj === 'object') {
expected = Object.keys(obj).length;
}

this.assert(
Object.keys(Object(flag(this, 'object'))).length === 0
!expected
, 'expected #{this} to be empty'
, 'expected #{this} not to be empty'
);
Expand Down

0 comments on commit 1b2c648

Please sign in to comment.