Repository: chaijs/chai (js)

Issue:
Requesting "does" as a no-op assertion
    expect(foobar).to.have.property("baz").which.does.not.have.property("thing");


Pull request description:
Add .does as a no-op assertion, Fix #700
Hello guys, I saw that #700 was marked as pull-request-wanted.
So here I am 😄 

I also did not find tests addressing no-op assertions.
Maybe I could add tests for it.

What do you guys think about it?

Patch:
diff --git a/lib/chai/core/assertions.js b/lib/chai/core/assertions.js
index 9ca0b0c..90c4a69 100644
--- a/lib/chai/core/assertions.js
+++ b/lib/chai/core/assertions.js
@@ -34,6 +34,7 @@ module.exports = function (chai, _) {
    * - of
    * - same
    * - but
+   * - does
    *
    * @name language chains
    * @namespace BDD
@@ -43,7 +44,7 @@ module.exports = function (chai, _) {
   [ 'to', 'be', 'been'
   , 'is', 'and', 'has', 'have'
   , 'with', 'that', 'which', 'at'
-  , 'of', 'same', 'but' ].forEach(function (chain) {
+  , 'of', 'same', 'but', 'does' ].forEach(function (chain) {
     Assertion.addProperty(chain);
   });
 


Test patch:
diff --git a/test/expect.js b/test/expect.js
index 04e79c4..aa9dc3f 100644
--- a/test/expect.js
+++ b/test/expect.js
@@ -10,6 +10,30 @@ describe('expect', function () {
     expect('foo').to.equal('foo');
   });
 
+  it('no-op chains', function() {
+    function test(chain) {
+      // tests that chain exists
+      expect(expect(1)[chain]).not.undefined;
+
+      // tests methods
+      expect(1)[chain].equal(1);
+
+      // tests properties that assert
+      expect(false)[chain].false;
+
+      // tests not
+      expect(false)[chain].not.true;
+
+      // tests chainable methods
+      expect([1, 2, 3])[chain].contains(1);
+    }
+
+    [ 'to', 'be', 'been'
+    , 'is', 'and', 'has', 'have'
+    , 'with', 'that', 'which', 'at'
+    , 'of', 'same', 'but', 'does' ].forEach(test);
+  });
+
   it('fail', function () {
     err(function() {
       expect.fail(0, 1, 'this has failed');
diff --git a/test/should.js b/test/should.js
index 7fdf495..37a4876 100644
--- a/test/should.js
+++ b/test/should.js
@@ -7,6 +7,30 @@ describe('should', function() {
     should.not.equal('foo', 'bar');
   });
 
+  it('no-op chains', function() {
+    function test(chain) {
+      // tests that chain exists
+      ((1).should[chain]).should.not.undefined;
+
+      // tests methods
+      (1).should[chain].equal(1);
+
+      // tests properties that assert
+      (false).should[chain].false;
+
+      // tests not
+      (false).should[chain].not.true;
+
+      // tests chainable methods
+      [1, 2, 3].should[chain].contains(1);
+    }
+
+    [ 'to', 'be', 'been'
+    , 'is', 'and', 'has', 'have'
+    , 'with', 'that', 'which', 'at'
+    , 'of', 'same', 'but', 'does' ].forEach(test);
+  });
+
   it('fail', function () {
     err(function() {
       should.fail(0, 1, 'this has failed');