{"name":"chai-fuzzy","version":"1.5.0","keywords":["chai","testing","jasmine"],"description":"fuzzy matchers for chai","main":"index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"git://github.com/elliotf/chai-fuzzy.git"},"author":{"name":"Elliot Foster"},"license":"MIT","devDependencies":{"chai":">=1.0.0","mocha":">=1.0.0","underscore":">= 1.0.0"},"peerDependencies":{"chai":">= 1.0.0"},"engines":{"npm":">= 1.2"},"gitHead":"2d6df13d976ee38eb06612abbce9d68345b4236d","bugs":{"url":"https://github.com/elliotf/chai-fuzzy/issues"},"homepage":"https://github.com/elliotf/chai-fuzzy","_id":"chai-fuzzy@1.5.0","_shasum":"017214ae189eee8fd8c5691b41d66bd46ed0b18b","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"elliotf","email":"efoster@firetaco.com"},"maintainers":[{"name":"elliotf","email":"efoster+opensource@firetaco.com"}],"dist":{"shasum":"017214ae189eee8fd8c5691b41d66bd46ed0b18b","tarball":"http://registry-npm.ywwl.com/chai-fuzzy/download/chai-fuzzy-1.5.0.tgz","integrity":"sha512-gfwhmG0J2hipkpFb8gYD3O1O3gN0Euke/+sQRZX0vwZs8RZCL/aqWTvDhlZvJbvqw39yjQS+1tUaV0myTFbWhg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEXmZIs6lmPjM+7agNQlT2MS7AXIMgY+wZ2rL1/aaPJsAiEA1iojLqgz5rRS1Y7DvMAQ56682CitmaSeIKApuusIpDo="}],"size":5991,"noattachment":false,"key":"/chai-fuzzy/-/chai-fuzzy-1.5.0.tgz"},"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":1426660377277,"_cnpm_publish_time":1426660377277,"dist-tags":{"latest":"1.6.1"}}