debitoor / chai-subset

"containSubset" object properties matcher for Chai
http://chaijs.com/plugins/chai-subset/
MIT License
82 stars 20 forks source link

NaN values? #72

Open jedwards1211 opened 5 years ago

jedwards1211 commented 5 years ago

Since NaN !== NaN, a NaN value causes containSubset to fail, and the error message is confusing because it looks like it's erroneously complaining about missing fields...

Maybe we should use Object.is or equivalent?

      expect({foo: NaN, bar: 'baz'}).to.containSubset({foo: NaN})
      AssertionError: expected { foo: NaN, bar: 'baz' } to contain subset { foo: NaN }
      + expected - actual

       {
      -  "bar": "baz"
         "foo": NaN
       }