{"name":"chai-fuzzy","version":"1.1.0","keywords":["chai","testing","jasmine"],"description":"fuzzy matchers for chai","main":"index.js","scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/elliotf/chai-fuzzy.git"},"author":"","license":"MIT","devDependencies":{"chai":"~1.2.0","mocha":"~1.6.0","nodemon":"~0.6.23"},"dependencies":{"underscore":"~1.4.1"},"_id":"chai-fuzzy@1.1.0","dist":{"shasum":"d64ca6236b26e72976bc15a5f3f8ed1ad1c7dc1d","tarball":"http://registry-npm.ywwl.com/chai-fuzzy/download/chai-fuzzy-1.1.0.tgz","integrity":"sha512-mLLNPW1j/+s8BUL9Gjv+c7sjBX8R5u6GAMASndEkBNpg8D9l5mUMkgckme4Xl1WelgH+I0OwyeS6bRz0vmkbXg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCnYf5niot69pL8DPmY7MzO+Bh+26MA95Cw4y7GdQq1LwIgJ4CfN7zoWib5Mr3KY+FVVCCWecucZANwyFl+cShqJDc="}],"size":4902,"noattachment":false,"key":"/chai-fuzzy/-/chai-fuzzy-1.1.0.tgz"},"_npmVersion":"1.1.62","_npmUser":{"name":"elliotf","email":"efoster+opensource@firetaco.com"},"maintainers":[{"name":"elliotf","email":"efoster+opensource@firetaco.com"}],"readme":"# chai-fuzzy\n\nFuzzy matchers for chai based on underscore and inspired by jasmine.\n\nMake assertions that values have all the same attributes and values without asserting strict object equality.\n\n[![Build Status](https://travis-ci.org/elliotf/chai-fuzzy.png)](https://travis-ci.org/elliotf/chai-fuzzy)\n\n## Using\n\nAlso see the [tests](https://github.com/elliotf/chai-fuzzy/tree/master/test/) and [examples](https://github.com/elliotf/chai-fuzzy/tree/master/examples/).\n\n### browser-side\n\ninclude chai fuzzy after chai and underscore:\n\n    <script src=\"underscore.js\"></script>\n    <script src=\"chai.js\"></script>\n    <script src=\"chai-fuzzy.js\"></script>\n\n### server-side\n\nhave chai use chai-fuzzy:\n\n    var chai = require('chai');\n    chai.use(require('chai-fuzzy'));\n\n## Assertions\n\n\n### like(value)\n\ncompare object attributes and values rather than checking to see if they're the same reference\n\n    var subject = {a: 'a'};\n    subject.should.be.like({a: 'a'});\n    subject.should.not.be.like({x: 'x'});\n    subject.should.not.be.like({a: 'a', b: 'b'});\n\n    expect(subject).to.be.like({a: 'a'});\n    expect(subject).not.to.be.like({x: 'x'});\n    expect(subject).not.to.be.like({a: 'a', b: 'b'});\n\n    assert.like(subject, {a: 'a'});\n    assert.notLike(subject, {x: 'x'});\n    assert.notLike(subject, {a: 'a', b: 'b'});\n\n    var subject = ['a'];\n    subject.should.be.like(['a']);\n    subject.should.not.be.like(['x']);\n    subject.should.not.be.like(['a', 'b']);\n\n    expect(subject).to.be.like(['a']);\n    expect(subject).not.to.be.like(['x']);\n    expect(subject).not.to.be.like(['a', 'b']);\n\n    assert.like(subject, ['a']);\n    assert.notLike(subject, ['x']);\n    assert.notLike(subject, ['a', 'b']);\n\n## containOneLike(value)\n\ncheck the first level of the container for a value like the one provided\n\n    var subject = {\n      a:   'alphabet'\n      , b: 'butternut'\n      , c: {\n        name:       'chowder'\n        , attributes: [\n          'scales'\n          , 'fins'\n        ]\n      }\n      , x: 'xylophone'\n      , z: 'xylophone'\n    };\n    subject.should.containOneLike({\n      name:         'chowder'\n      , attributes: [\n        'scales', 'fins'\n      ]\n    });\n    subject.should.not.containOneLike({\n      name:         'chowder'\n      , attributes: [\n        'scales', 'fins', 'cream'\n      ]\n    });\n\n    subject.should.containOneLike('xylophone');\n    subject.should.not.containOneLike('cow patties');\n\n    expect(subject).to.containOneLike('xylophone');\n    expect(subject).to.not.containOneLike('cow patties');\n\n    assert.containOneLike(subject, 'xylophone');\n    assert.notContainOneLike(subject, 'cow patties');\n\n    // same for arrays\n\n# jsonOf(value)\n\ncheck that the given javascript object is like the JSON-ified expected value.  Useful for checking stringification and parsing of an object.\n\n    var apple = {\n      skin: 'thin'\n      , colors: ['red', 'green', 'yellow']\n      , isFruit: true\n      , picked: new Date()\n    };\n    var orange = {\n      skin: 'thin'\n      , colors: ['red', 'green', 'yellow']\n      , isFruit: true\n      , picked: new Date()\n    };\n    // here appleJSON would be the json result of some process like a JSON api\n    var appleJSON  = JSON.parse(JSON.stringify(apple));\n\n    appleJSON.should.be.jsonOf(apple);\n    appleJSON.should.not.be.jsonOf(orange);\n\n    expect(appleJSON).to.be.jsonOf(apple);\n    expect(appleJSON).to.not.be.jsonOf(orange);\n\n    assert.jsonOf(appleJSON, apple);\n    assert.notJsonOf(appleJSON, orange);\n\n# Thanks\n\nThanks to [Davis](http://github.com/infews/ \"Davis\") for passing along the idea of using underscore rather than cribbing parts of jasmine.\n\nThanks to [Bart van der Schoor](https://github.com/Bartvds \"Bart van der Schoor\") for adding assert-style compatibility\n\n","publish_time":1349637169860,"_cnpm_publish_time":1349637169860,"dist-tags":{"latest":"1.6.1"}}