{"_id":"macgyver","_rev":"44-91d118723e78c9629c3938c22c586fce","name":"macgyver","description":"[![build status](https://secure.travis-ci.org/dominictarr/macgyver.png)](http://travis-ci.org/dominictarr/macgyver) [![browser status](http://ci.testling.com/dominictarr/macgyver.png)](http://ci.testling.com/dominictarr/macgyver) declarative assertion framework for invocation ordering.","dist-tags":{"latest":"1.10.1"},"versions":{"0.0.0":{"name":"macgyver","version":"0.0.0","description":"","homepage":"http://github.com/dominictarr/macgyver","repository":{"type":"git","url":"git://github.com/dominictarr/macgyver.git"},"dependencies":{},"devDependencies":{},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"scripts":{"test":"meta-test test/*.js"},"_npmJsonOpts":{"file":"/home/dominic/.npm/macgyver/0.0.0/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"macgyver@0.0.0","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.27","_nodeVersion":"v0.4.10","_defaultsLoaded":true,"dist":{"shasum":"468b1b2e1be82830eb930c5db8ff897d7faa86b7","tarball":"https://registry.npmjs.org/macgyver/-/macgyver-0.0.0.tgz","integrity":"sha512-o50LKBOAH4FQy0695tPI8wf4J2595mqKQIffha9VqUuphH8Awj1Y4csnCb5Kb3b3n1Y7luwxShAxe31qaHkkJg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFrRYoAzXG4y0Tm7mfr+8TXhpuJo0rtSG8+0tzMBHgCcAiEA4XZoeTuhBhY+vMOACJ+aI8SckWO2oocdwSuyq2t6r0o="}]},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{}},"1.0.0":{"name":"macgyver","version":"1.0.0","description":"","homepage":"http://github.com/dominictarr/macgyver","repository":{"type":"git","url":"https://github.com/dominictarr/macgyver.git"},"dependencies":{},"devDependencies":{"assertions":"2.3"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"scripts":{"test":"node test/index.js"},"_id":"macgyver@1.0.0","dist":{"shasum":"6cf44ce01afac96d09a8d618bb6006faecb1b471","tarball":"https://registry.npmjs.org/macgyver/-/macgyver-1.0.0.tgz","integrity":"sha512-/o3G2Gds8AucLWoio2CxwQ0r1dJz5LgzYmA+ORWbL8LX+fn4YSoSh8CWVSZgmYSM3aP+XoButDIOzfil0WZK4w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDUp3W9qBRdY7v7u6ZPS1b3e81oZKtpofDWcqaY5tyrBAiEAtbLqwwhsio9XpfjIgPH0MOLosDgAnKtGdfBBi+K1hRM="}]},"readme":"","maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{}},"1.2.0":{"name":"macgyver","version":"1.2.0","description":"","homepage":"http://github.com/dominictarr/macgyver","repository":{"type":"git","url":"https://github.com/dominictarr/macgyver.git"},"dependencies":{"assertions":"2.3"},"devDependencies":{"tap":"0.2"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"scripts":{"test":"tap test/*.js"},"_id":"macgyver@1.2.0","dist":{"shasum":"4f2a3f3547799296aaf19739b674f5085a3f70a8","tarball":"https://registry.npmjs.org/macgyver/-/macgyver-1.2.0.tgz","integrity":"sha512-H700kyPbPGDUR7sgG2DLtEGzVPgGyU3fhareMfkbUyy5ydNxQCTnB80RRk1EY2w89mQpJUgemEMyOdES6VAwEw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF8JnhNqdeSvjaXneF0on+Y9M1kuqis1pOMQ9woKa7vLAiEAlva9hoJYpNghojeWwSeIpFnVDjfoWRSKWj9jeoruG6A="}]},"readme":"","maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{}},"1.3.0":{"name":"macgyver","version":"1.3.0","description":"","homepage":"http://github.com/dominictarr/macgyver","repository":{"type":"git","url":"https://github.com/dominictarr/macgyver.git"},"dependencies":{"assertions":"2.3"},"devDependencies":{"tap":"0.2"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"scripts":{"test":"tap test/*.js"},"_id":"macgyver@1.3.0","dist":{"shasum":"6f64f7a2749abc3d01b540ac4940ea0453aa3b24","tarball":"https://registry.npmjs.org/macgyver/-/macgyver-1.3.0.tgz","integrity":"sha512-MEEerAoRYN0ogboK2n35yZYyzJQ0wlmgvVc8Ssshk3yYTMJd6oJbwlJVjg4SZoAkUb1t801IIiJurLZXAPmsLQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE+Ew+SvuQK6fIN9KdVjCRaZLKSS9D0o8/kWfbEU8okRAiBPj9OrjG8HuFDo4Fv/2xhVcFEEdeRxqpNgKvvUZquLlg=="}]},"readme":"","maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{}},"1.4.0":{"name":"macgyver","version":"1.4.0","description":"","homepage":"http://github.com/dominictarr/macgyver","repository":{"type":"git","url":"https://github.com/dominictarr/macgyver.git"},"dependencies":{"assertions":"2.3"},"devDependencies":{"tap":"0.2"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"scripts":{"test":"tap test/*.js"},"_id":"macgyver@1.4.0","dist":{"shasum":"a0e13827898008893266bda21d87d340aad2fe1b","tarball":"https://registry.npmjs.org/macgyver/-/macgyver-1.4.0.tgz","integrity":"sha512-uCB9FTL5hHBrQwc4LGCrUQyy1ANWqGhN0ubUPkCe/hS91lF9Y51UVCcS8XCCckwxb9ZyUCxkIn+pllBU4AxIBw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCFGyyAu/1kq/LBmuKEx22YF5mDfMyAvwNoc3tyXAKsZAIhAKQxgGHpGjDUCUv0J7HzitNbO/taSuSA7YMIlKRHkeeY"}]},"readme":"","maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{}},"1.5.0":{"name":"macgyver","version":"1.5.0","description":"","homepage":"http://github.com/dominictarr/macgyver","repository":{"type":"git","url":"https://github.com/dominictarr/macgyver.git"},"dependencies":{"assertions":"2.3"},"devDependencies":{"synct":"~1.0.0"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"scripts":{"test":"synct test/*.js"},"_id":"macgyver@1.5.0","dist":{"shasum":"838707593d637169569ef1ea732f58e5ba738ddf","tarball":"https://registry.npmjs.org/macgyver/-/macgyver-1.5.0.tgz","integrity":"sha512-Ei1XQors5IX4pi3ywxLYLo6oPefow0UZf0OEY9/D/SnSmi8linE6IgdFGZ2TfTxfeniVPx+e0HSa/u6BUxa4mw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCxckd56O+naBD+OlNxRKwDVF7KKdraBTk/X9hiXhbb3gIhAP1uW/R5z1YHwmbRlLxDhVwPT5LsTHK2OLuwis4J5266"}]},"readme":"","maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{}},"1.6.0":{"name":"macgyver","version":"1.6.0","description":"","homepage":"http://github.com/dominictarr/macgyver","repository":{"type":"git","url":"https://github.com/dominictarr/macgyver.git"},"dependencies":{"assertions":"2.3"},"devDependencies":{"synct":"~1.0.0"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"scripts":{"test":"synct test/*.js"},"_id":"macgyver@1.6.0","dist":{"shasum":"5ffe369c3056fa6c208107f2a663ca4374f864df","tarball":"https://registry.npmjs.org/macgyver/-/macgyver-1.6.0.tgz","integrity":"sha512-w9RSJUPrBNppn2lRxEkGUpQzbkeMIiXbPy1jaPlsWF/JZchJyHsheq7r4cwpGesdgzMCHnmhcN3byhm7laD+4g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHGBJwmGY5ikEbnWKcI3i6X6NpKykNlVqHD2GMPPOJS9AiBoNUkWU6nxQt1sJa4cmIzHjJUg7xB/UPUiZLH/Uk/x2A=="}]},"readme":"","maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{}},"1.6.1":{"name":"macgyver","version":"1.6.1","description":"","homepage":"http://github.com/dominictarr/macgyver","repository":{"type":"git","url":"https://github.com/dominictarr/macgyver.git"},"dependencies":{"assertions":"2.3"},"devDependencies":{"synct":"~1.0.0"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"scripts":{"test":"synct test/*.js"},"_id":"macgyver@1.6.1","dist":{"shasum":"421d9d923d5d5e9bd28fb66afd6514503e2d5bac","tarball":"https://registry.npmjs.org/macgyver/-/macgyver-1.6.1.tgz","integrity":"sha512-FbEyxalCHIDz7hCNEsYNwF8mVjeo6GDXO82DCJIguoGECxUpzBQpJAp6r9J9Mi+jIQCxHOWmSDVhTtFbT+n+cw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEzXvo008hQNpam6PEGS5vlsD2lIdXwLMcQJ5/5jXsM2AiEA2JgKX7Wv6RfhSuxh8qyVndn0Lvw8h3iktjtoNA5kTGE="}]},"readme":"","maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{}},"1.6.2":{"name":"macgyver","version":"1.6.2","description":"","homepage":"http://github.com/dominictarr/macgyver","repository":{"type":"git","url":"https://github.com/dominictarr/macgyver.git"},"dependencies":{"assertions":"2.3"},"devDependencies":{"synct":"~1.0.0"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"scripts":{"test":"synct test/*.js"},"_id":"macgyver@1.6.2","dist":{"shasum":"6541b25888a559ca5e1f41714798a570f520c96b","tarball":"https://registry.npmjs.org/macgyver/-/macgyver-1.6.2.tgz","integrity":"sha512-a9ZA4dijjDIXiK4DrSaQtq5jQs4fko0pqzRA36tF3gH/xBkgoy7cCirwG5vVsa8bkZiXxjBSBJ1HvYQ2SqsmGQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCRr00ntwc5QqGQsp9j4p0YIoSx6it568+ivM3omn5LVAIgCI7NC+97z1NvMvz2XIDOPOf+A7t3H2bq+hnVkSJaVpE="}]},"readme":"","maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{}},"1.6.3":{"name":"macgyver","version":"1.6.3","description":"","homepage":"http://github.com/dominictarr/macgyver","repository":{"type":"git","url":"https://github.com/dominictarr/macgyver.git"},"dependencies":{"assertions":"2.3"},"keywords":["spec","test","order","eventually","before","critical"],"devDependencies":{"synct":"~1.0.0"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"scripts":{"test":"synct test/*.js"},"_id":"macgyver@1.6.3","dist":{"shasum":"da971942df0c443579dca861732020a905dfb2b8","tarball":"https://registry.npmjs.org/macgyver/-/macgyver-1.6.3.tgz","integrity":"sha512-2PgUS2vDJO4/u8q8JYLLX6aRmVL+DBZuNYdDQGCgSdbvYo/TV2JqG6NjjQ1kGy7PcKzRkW4TmRNE3GSrAljFSA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICyvG7T5zZIBJ7gjPY3MVDHZDUYd8ldDkRBpls0AMo9tAiAoKAK3Y2WWN7v0Kd0Q70kaeZ6fMI68HtfQ0rJRb86zLQ=="}]},"readme":"","maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{}},"1.7.0":{"name":"macgyver","version":"1.7.0","description":"[![build status](https://secure.travis-ci.org/dominictarr/macgyver.png)](http://travis-ci.org/dominictarr/macgyver)","homepage":"http://github.com/dominictarr/macgyver","repository":{"type":"git","url":"https://github.com/dominictarr/macgyver.git"},"dependencies":{"assertions":"2.3"},"keywords":["spec","test","order","eventually","before","critical"],"devDependencies":{"synct":"~1.0.0"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"scripts":{"test":"synct test/*.js"},"readme":"# macgyver\n\n[![build status](https://secure.travis-ci.org/dominictarr/macgyver.png)](http://travis-ci.org/dominictarr/macgyver)\n\ndeclarative assertion framework for invocation ordering.\n\nwhen evented code really gets _mission critical_ there is one man you send in...\n\nuseful for testing streams, and other complex evented modules.\n\n## example\n\n``` js\n\nvar macgyver = require('macgyver')\n\n//create a context\nvar mac = macgyver()\n\n//wrap a function...\n\nfunction hello () {\n  console.log('hello')\n}\n\nfunction goodbye () {\n  console.log('goodbye')\n}\n\nvar hi = mac(hello)\n\n//declare it's behaviours\n\nhi.isCalled(1, 7) //must be called between 1 and 7 times.\n\nvar bye = mac(goodbye).once() //must be called strictly once.\n\nhi.before(bye) //hi must be called strictly before bye is called\n\nhi(); hi(); bye()\n\n/*\n  //this will produce an error!\n  hi(); hi(); bye(); hi()\n*/\n\nmac.validate()\n```\n\nhere is a real life example: [dominictarr/event-stream/test/spec.js](https://github.com/dominictarr/event-stream/blob/3f4f5cb57fb61144751ab5fe643b8974ab9007aa/test/spec.js#L14-56)\n\n## API\n\ncreate a `maggyver` context.\n\n``` js\nvar macgyver = require('macgyver')\nvar mac = macgyver()\n\n```\n\nwrap a function \n\n``` js\n\nfunction doSomething() {}\n\nvar _doSomething = mac(doSomething)\n\n```\n\nnow, we can make declairations about how the wrapped function must be called.\n\n### isCalled(min, max)\nassert that the function is called at least `min` times, and at most `max` times.\nif `min`, or `max` is null, then that bound is not checked. i.e. `mac(fun).isCalled(null, 10)`\nwill assert that `fun` is called not more than 10 times.\n\n### once()\nalias for `isCalled (1, 1)`\n\n### times(n)\nalias for `isCalled (n, n)`\n\n### eventually()\nalias for `isCalled (null, 1)`\n\n### never()\nalias for `isCalled (0, 0)`\n\n### maybeOnce()\nalias for `isCalled (null, 1)`\n\n### atMost(max)\nalias for `isCalled (null, max)`\n\n### atLeast(min)\nalias for `isCalled (min, null)`\n\n### again (inc=1)\nincrements the number of times a function may be called.\n(inc may be negative)\n\n### before (other)\n\nassert that a function is called before another function.\nthe `other` must also be a wrapped function.\n`mac(first).before(second = mac(second))`\n\n`before` does not check wether the second function is eventually called or not. use `isCalled` or an alias.\n\n### beforeReturns (other)\n\njust like `before` but checks that the function is called before the other function returns, so that it is possible for the first function to be called by the other.\n\n### returns (value)\n\nassert that a function returns a value.\nif value is a function, it will be called with the return value.\n``` js\n//assert that fun returns a string.\nmac(fun).returns(function (val) {\n  assert.equal(typeof val, 'string')\n})\n\n```\n\nthe function should throw if the return value was not valid.\n\n### isPassed (args)\n\nassert that a function is passed the correct arguments.\nif `args` is a function, that function is called as in returns.\n\n### throws (test)\n\nassert that a function throws. test may be a value or a function. `test` is optional. \n\nif supplyed `test` is called on every call.\n\n``` js \nmac(fun).throws(function (err, threw) {\n  if(threw) {\n    assert.equal(err.code,'ERRCODE') //check correct error\n  } else {\n    //what to do if there was no error?\n  }\n})\n```\nthis is useful for checking conditions about when the error should be thrown. example [stream\\#write](https://github.com/dominictarr/event-stream/blob/3f4f5cb57fb61144751ab5fe643b8974ab9007aa/test/spec.js#L32-36)\n\n### validate ()\n\ncheck all rules passed. must be called once you are sure all calls are finished.\nfor example `process.on('exit', mac.validate)` is a good time. `validate` in necessary\nto check that lower bounds of `isCalled` and aliases where met.\n\n## more coming!\n\n## license\n\nMIT / Apachce2\n","_id":"macgyver@1.7.0","dist":{"shasum":"531ceec035acad3579f35fdaefe7b7601a1927ff","tarball":"https://registry.npmjs.org/macgyver/-/macgyver-1.7.0.tgz","integrity":"sha512-bewAC2qZ0klA13+tS6Fihex5yBbBjR2mNo3GNkCIEJDSA/IzjfTyRqrjPOQvJy5ENX3o74Apmt7TFI9B/2BV4A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD8SB9rceylxSEpP1JEAuqKsE83C0+MVf/urqPkzRNG8QIhANmKALUU8gKcycL2DZtBS1Gg+98HbTdyQQdgEz6BoSp2"}]},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{}},"1.8.0":{"name":"macgyver","version":"1.8.0","description":"[![build status](https://secure.travis-ci.org/dominictarr/macgyver.png)](http://travis-ci.org/dominictarr/macgyver)","homepage":"http://github.com/dominictarr/macgyver","repository":{"type":"git","url":"https://github.com/dominictarr/macgyver.git"},"dependencies":{"assertions":"2.3"},"keywords":["spec","test","order","eventually","before","critical"],"devDependencies":{"synct":"~1.0.0"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"scripts":{"test":"synct test/*.js"},"readme":"# macgyver\n\n[![build status](https://secure.travis-ci.org/dominictarr/macgyver.png)](http://travis-ci.org/dominictarr/macgyver)\n\ndeclarative assertion framework for invocation ordering.\n\nwhen evented code really gets _mission critical_ there is one man you send in...\n\nuseful for testing streams, and other complex evented modules.\n\n## example\n\n``` js\n\nvar macgyver = require('macgyver')\n\n//create a context\nvar mac = macgyver()\n\n//wrap a function...\n\nfunction hello () {\n  console.log('hello')\n}\n\nfunction goodbye () {\n  console.log('goodbye')\n}\n\nvar hi = mac(hello)\n\n//declare it's behaviours\n\nhi.isCalled(1, 7) //must be called between 1 and 7 times.\n\nvar bye = mac(goodbye).once() //must be called strictly once.\n\nhi.before(bye) //hi must be called strictly before bye is called\n\nhi(); hi(); bye()\n\n/*\n  //this will produce an error!\n  hi(); hi(); bye(); hi()\n*/\n\nmac.validate()\n```\n\nhere is a real life example: [dominictarr/event-stream/test/spec.js](https://github.com/dominictarr/event-stream/blob/3f4f5cb57fb61144751ab5fe643b8974ab9007aa/test/spec.js#L14-56)\n\n## API\n\ncreate a `maggyver` context.\n\n``` js\nvar macgyver = require('macgyver')\nvar mac = macgyver()\n\n```\n\nwrap a function \n\n``` js\n\nfunction doSomething() {}\n\nvar _doSomething = mac(doSomething)\n\n```\n\nnow, we can make declairations about how the wrapped function must be called.\n\n### isCalled(min, max)\nassert that the function is called at least `min` times, and at most `max` times.\nif `min`, or `max` is null, then that bound is not checked. i.e. `mac(fun).isCalled(null, 10)`\nwill assert that `fun` is called not more than 10 times.\n\n### once()\nalias for `isCalled (1, 1)`\n\n### times(n)\nalias for `isCalled (n, n)`\n\n### eventually()\nalias for `isCalled (null, 1)`\n\n### never()\nalias for `isCalled (0, 0)`\n\n### maybeOnce()\nalias for `isCalled (null, 1)`\n\n### atMost(max)\nalias for `isCalled (null, max)`\n\n### atLeast(min)\nalias for `isCalled (min, null)`\n\n### again (inc=1)\nincrements the number of times a function may be called.\n(inc may be negative)\n\n### before (other)\n\nassert that a function is called before another function.\nthe `other` must also be a wrapped function.\n`mac(first).before(second = mac(second))`\n\n`before` does not check wether the second function is eventually called or not. use `isCalled` or an alias.\n\n### beforeReturns (other)\n\njust like `before` but checks that the function is called before the other function returns, so that it is possible for the first function to be called by the other.\n\n### returns (value)\n\nassert that a function returns a value.\nif value is a function, it will be called with the return value.\n``` js\n//assert that fun returns a string.\nmac(fun).returns(function (val) {\n  assert.equal(typeof val, 'string')\n})\n\n```\n\nthe function should throw if the return value was not valid.\n\n### isPassed (args)\n\nassert that a function is passed the correct arguments.\nif `args` is a function, that function is called as in returns.\n\n### throws (test)\n\nassert that a function throws. test may be a value or a function. `test` is optional. \n\nif supplyed `test` is called on every call.\n\n``` js \nmac(fun).throws(function (err, threw) {\n  if(threw) {\n    assert.equal(err.code,'ERRCODE') //check correct error\n  } else {\n    //what to do if there was no error?\n  }\n})\n```\nthis is useful for checking conditions about when the error should be thrown. example [stream\\#write](https://github.com/dominictarr/event-stream/blob/3f4f5cb57fb61144751ab5fe643b8974ab9007aa/test/spec.js#L32-36)\n\n### validate ()\n\ncheck all rules passed. must be called once you are sure all calls are finished.\nfor example `process.on('exit', mac.validate)` is a good time. `validate` in necessary\nto check that lower bounds of `isCalled` and aliases where met.\n\n## more coming!\n\n## license\n\nMIT / Apachce2\n","_id":"macgyver@1.8.0","dist":{"shasum":"5e11411532685d7c67b0bfe2346ae1f86e06a55e","tarball":"https://registry.npmjs.org/macgyver/-/macgyver-1.8.0.tgz","integrity":"sha512-jg8nwEmwbpmd5zU4F1T6Y7i5GdGOpKMJcuQ/UKNJuYk3fgf3cjA8YELH9KIW3cP+SqrTv3LWuAGFUXbE8gTKIw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCQ2vL/shDsbj+/k6DqCc7172AS8QfCkND+BUJfUkGlDQIgUIbTZQgT0rGOdgJzvTuVfoZLp1hRkFItsHPwnJ0WNlU="}]},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{}},"1.8.1":{"name":"macgyver","version":"1.8.1","description":"[![build status](https://secure.travis-ci.org/dominictarr/macgyver.png)](http://travis-ci.org/dominictarr/macgyver)","homepage":"http://github.com/dominictarr/macgyver","repository":{"type":"git","url":"https://github.com/dominictarr/macgyver.git"},"dependencies":{"assertions":"2.3"},"keywords":["spec","test","order","eventually","before","critical"],"devDependencies":{"synct":"~1.0.0"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"scripts":{"test":"synct test/*.js"},"readme":"# macgyver\n\n[![build status](https://secure.travis-ci.org/dominictarr/macgyver.png)](http://travis-ci.org/dominictarr/macgyver)\n\ndeclarative assertion framework for invocation ordering.\n\nwhen evented code really gets _mission critical_ there is one man you send in...\n\nuseful for testing streams, and other complex evented modules.\n\n## example\n\n``` js\n\nvar macgyver = require('macgyver')\n\n//create a context\nvar mac = macgyver()\n\n//wrap a function...\n\nfunction hello () {\n  console.log('hello')\n}\n\nfunction goodbye () {\n  console.log('goodbye')\n}\n\nvar hi = mac(hello)\n\n//declare it's behaviours\n\nhi.isCalled(1, 7) //must be called between 1 and 7 times.\n\nvar bye = mac(goodbye).once() //must be called strictly once.\n\nhi.before(bye) //hi must be called strictly before bye is called\n\nhi(); hi(); bye()\n\n/*\n  //this will produce an error!\n  hi(); hi(); bye(); hi()\n*/\n\nmac.validate()\n```\n\nhere is a real life example: [dominictarr/event-stream/test/spec.js](https://github.com/dominictarr/event-stream/blob/3f4f5cb57fb61144751ab5fe643b8974ab9007aa/test/spec.js#L14-56)\n\n## API\n\ncreate a `maggyver` context.\n\n``` js\nvar macgyver = require('macgyver')\nvar mac = macgyver()\n\n```\n\nwrap a function \n\n``` js\n\nfunction doSomething() {}\n\nvar _doSomething = mac(doSomething)\n\n```\n\nnow, we can make declairations about how the wrapped function must be called.\n\n### isCalled(min, max)\nassert that the function is called at least `min` times, and at most `max` times.\nif `min`, or `max` is null, then that bound is not checked. i.e. `mac(fun).isCalled(null, 10)`\nwill assert that `fun` is called not more than 10 times.\n\n### once()\nalias for `isCalled (1, 1)`\n\n### times(n)\nalias for `isCalled (n, n)`\n\n### eventually()\nalias for `isCalled (null, 1)`\n\n### never()\nalias for `isCalled (0, 0)`\n\n### maybeOnce()\nalias for `isCalled (null, 1)`\n\n### atMost(max)\nalias for `isCalled (null, max)`\n\n### atLeast(min)\nalias for `isCalled (min, null)`\n\n### again (inc=1)\nincrements the number of times a function may be called.\n(inc may be negative)\n\n### before (other)\n\nassert that a function is called before another function.\nthe `other` must also be a wrapped function.\n`mac(first).before(second = mac(second))`\n\n`before` does not check wether the second function is eventually called or not. use `isCalled` or an alias.\n\n### beforeReturns (other)\n\njust like `before` but checks that the function is called before the other function returns, so that it is possible for the first function to be called by the other.\n\n### returns (value)\n\nassert that a function returns a value.\nif value is a function, it will be called with the return value.\n``` js\n//assert that fun returns a string.\nmac(fun).returns(function (val) {\n  assert.equal(typeof val, 'string')\n})\n\n```\n\nthe function should throw if the return value was not valid.\n\n### isPassed (args)\n\nassert that a function is passed the correct arguments.\nif `args` is a function, that function is called as in returns.\n\n### throws (test)\n\nassert that a function throws. test may be a value or a function. `test` is optional. \n\nif supplyed `test` is called on every call.\n\n``` js \nmac(fun).throws(function (err, threw) {\n  if(threw) {\n    assert.equal(err.code,'ERRCODE') //check correct error\n  } else {\n    //what to do if there was no error?\n  }\n})\n```\nthis is useful for checking conditions about when the error should be thrown. example [stream\\#write](https://github.com/dominictarr/event-stream/blob/3f4f5cb57fb61144751ab5fe643b8974ab9007aa/test/spec.js#L32-36)\n\n### validate ()\n\ncheck all rules passed. must be called once you are sure all calls are finished.\nfor example `process.on('exit', mac.validate)` is a good time. `validate` in necessary\nto check that lower bounds of `isCalled` and aliases where met.\n\n## more coming!\n\n## license\n\nMIT / Apachce2\n","_id":"macgyver@1.8.1","dist":{"shasum":"ccdb9317c0b3a724192fed474046b898772308fa","tarball":"https://registry.npmjs.org/macgyver/-/macgyver-1.8.1.tgz","integrity":"sha512-bVtrf6iCwi1wGTSlDfHErU+f/RcRYBhIDsStfGi05Rbnzs6VcxbuKFyLYAALWvtcEMWygf5vrbelxovNhVduzw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC0K/lrk8i4GTLERiRvwIUOGsnfsJ9EJA6HncjVsfPnbAiBqPDJnoV2sVdbWV30Xci/ILmDmmgio04shzxMJ3Cm5JA=="}]},"_npmVersion":"1.1.59","_npmUser":{"name":"dominictarr","email":"dominic.tarr@gmail.com"},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{}},"1.8.2":{"name":"macgyver","version":"1.8.2","description":"[![build status](https://secure.travis-ci.org/dominictarr/macgyver.png)](http://travis-ci.org/dominictarr/macgyver)","homepage":"http://github.com/dominictarr/macgyver","repository":{"type":"git","url":"https://github.com/dominictarr/macgyver.git"},"dependencies":{"assertions":"2.3"},"keywords":["spec","test","order","eventually","before","critical"],"devDependencies":{"synct":"~1.0.0"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"scripts":{"test":"synct test/*.js"},"readme":"# macgyver\n\n[![build status](https://secure.travis-ci.org/dominictarr/macgyver.png)](http://travis-ci.org/dominictarr/macgyver)\n\ndeclarative assertion framework for invocation ordering.\n\nwhen evented code really gets _mission critical_ there is one man you send in...\n\nuseful for testing streams, and other complex evented modules.\n\n## example\n\n``` js\n\nvar macgyver = require('macgyver')\n\n//create a context\nvar mac = macgyver()\n\n//wrap a function...\n\nfunction hello () {\n  console.log('hello')\n}\n\nfunction goodbye () {\n  console.log('goodbye')\n}\n\nvar hi = mac(hello)\n\n//declare it's behaviours\n\nhi.isCalled(1, 7) //must be called between 1 and 7 times.\n\nvar bye = mac(goodbye).once() //must be called strictly once.\n\nhi.before(bye) //hi must be called strictly before bye is called\n\nhi(); hi(); bye()\n\n/*\n  //this will produce an error!\n  hi(); hi(); bye(); hi()\n*/\n\nmac.validate()\n```\n\nhere is a real life example: [dominictarr/event-stream/test/spec.js](https://github.com/dominictarr/event-stream/blob/3f4f5cb57fb61144751ab5fe643b8974ab9007aa/test/spec.js#L14-56)\n\n## API\n\ncreate a `maggyver` context.\n\n``` js\nvar macgyver = require('macgyver')\nvar mac = macgyver()\n\n```\n\nwrap a function \n\n``` js\n\nfunction doSomething() {}\n\nvar _doSomething = mac(doSomething)\n\n```\n\nnow, we can make declairations about how the wrapped function must be called.\n\n### isCalled(min, max)\nassert that the function is called at least `min` times, and at most `max` times.\nif `min`, or `max` is null, then that bound is not checked. i.e. `mac(fun).isCalled(null, 10)`\nwill assert that `fun` is called not more than 10 times.\n\n### once()\nalias for `isCalled (1, 1)`\n\n### times(n)\nalias for `isCalled (n, n)`\n\n### eventually()\nalias for `isCalled (null, 1)`\n\n### never()\nalias for `isCalled (0, 0)`\n\n### maybeOnce()\nalias for `isCalled (null, 1)`\n\n### atMost(max)\nalias for `isCalled (null, max)`\n\n### atLeast(min)\nalias for `isCalled (min, null)`\n\n### again (inc=1)\nincrements the number of times a function may be called.\n(inc may be negative)\n\n### before (other)\n\nassert that a function is called before another function.\nthe `other` must also be a wrapped function.\n`mac(first).before(second = mac(second))`\n\n`before` does not check wether the second function is eventually called or not. use `isCalled` or an alias.\n\n### beforeReturns (other)\n\njust like `before` but checks that the function is called before the other function returns, so that it is possible for the first function to be called by the other.\n\n### returns (value)\n\nassert that a function returns a value.\nif value is a function, it will be called with the return value.\n``` js\n//assert that fun returns a string.\nmac(fun).returns(function (val) {\n  assert.equal(typeof val, 'string')\n})\n\n```\n\nthe function should throw if the return value was not valid.\n\n### isPassed (args)\n\nassert that a function is passed the correct arguments.\nif `args` is a function, that function is called as in returns.\n\n### throws (test)\n\nassert that a function throws. test may be a value or a function. `test` is optional. \n\nif supplyed `test` is called on every call.\n\n``` js \nmac(fun).throws(function (err, threw) {\n  if(threw) {\n    assert.equal(err.code,'ERRCODE') //check correct error\n  } else {\n    //what to do if there was no error?\n  }\n})\n```\nthis is useful for checking conditions about when the error should be thrown. example [stream\\#write](https://github.com/dominictarr/event-stream/blob/3f4f5cb57fb61144751ab5fe643b8974ab9007aa/test/spec.js#L32-36)\n\n### validate ()\n\ncheck all rules passed. must be called once you are sure all calls are finished.\nfor example `process.on('exit', mac.validate)` is a good time. `validate` in necessary\nto check that lower bounds of `isCalled` and aliases where met.\n\n## more coming!\n\n## license\n\nMIT / Apachce2\n","_id":"macgyver@1.8.2","dist":{"shasum":"316f07cc6af17cfcfbdfa3ffd5ce7b6bb8f49629","tarball":"https://registry.npmjs.org/macgyver/-/macgyver-1.8.2.tgz","integrity":"sha512-UynBqKIeMVrvdtIKZKGoDhiQIDeG1+lcr5HRtpEhuzGIpOQimWBCelygqjqbbtJGPV4P9MYkWBURZYi8D9IxyA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB3ZJfVHpewjiZgmRkKJ1UDcCj7KQtQFS6KvJDOdM5LGAiAEI8q+yOjl6nLeaEHLJnvh0mBS5oIYMbLl+t6tvhyvnQ=="}]},"_npmVersion":"1.1.59","_npmUser":{"name":"dominictarr","email":"dominic.tarr@gmail.com"},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{}},"1.9.0":{"name":"macgyver","version":"1.9.0","description":"[![build status](https://secure.travis-ci.org/dominictarr/macgyver.png)](http://travis-ci.org/dominictarr/macgyver)","homepage":"http://github.com/dominictarr/macgyver","repository":{"type":"git","url":"https://github.com/dominictarr/macgyver.git"},"dependencies":{"assertions":"2.3"},"keywords":["spec","test","order","eventually","before","critical"],"devDependencies":{"synct":"~1.0.0"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"scripts":{"test":"synct test/*.js"},"readme":"# macgyver\n\n[![build status](https://secure.travis-ci.org/dominictarr/macgyver.png)](http://travis-ci.org/dominictarr/macgyver)\n\ndeclarative assertion framework for invocation ordering.\n\nwhen evented code really gets _mission critical_ there is one man you send in...\n\nuseful for testing streams, and other complex evented modules.\n\n## example\n\n``` js\n\nvar macgyver = require('macgyver')\n\n//create a context\nvar mac = macgyver()\n\n//wrap a function...\n\nfunction hello () {\n  console.log('hello')\n}\n\nfunction goodbye () {\n  console.log('goodbye')\n}\n\nvar hi = mac(hello)\n\n//declare it's behaviours\n\nhi.isCalled(1, 7) //must be called between 1 and 7 times.\n\nvar bye = mac(goodbye).once() //must be called strictly once.\n\nhi.before(bye) //hi must be called strictly before bye is called\n\nhi(); hi(); bye()\n\n/*\n  //this will produce an error!\n  hi(); hi(); bye(); hi()\n*/\n\nmac.validate()\n```\n\nhere is a real life example: [dominictarr/event-stream/test/spec.js](https://github.com/dominictarr/event-stream/blob/3f4f5cb57fb61144751ab5fe643b8974ab9007aa/test/spec.js#L14-56)\n\n## API\n\ncreate a `maggyver` context.\n\n``` js\nvar macgyver = require('macgyver')\nvar mac = macgyver()\n\n```\n\nwrap a function \n\n``` js\n\nfunction doSomething() {}\n\nvar _doSomething = mac(doSomething)\n\n```\n\nnow, we can make declairations about how the wrapped function must be called.\n\n### isCalled(min, max)\nassert that the function is called at least `min` times, and at most `max` times.\nif `min`, or `max` is null, then that bound is not checked. i.e. `mac(fun).isCalled(null, 10)`\nwill assert that `fun` is called not more than 10 times.\n\n### once()\nalias for `isCalled (1, 1)`\n\n### times(n)\nalias for `isCalled (n, n)`\n\n### eventually()\nalias for `isCalled (null, 1)`\n\n### never()\nalias for `isCalled (0, 0)`\n\n### maybeOnce()\nalias for `isCalled (null, 1)`\n\n### atMost(max)\nalias for `isCalled (null, max)`\n\n### atLeast(min)\nalias for `isCalled (min, null)`\n\n### again (inc=1)\nincrements the number of times a function may be called.\n(inc may be negative)\n\n### before (other)\n\nassert that a function is called before another function.\nthe `other` must also be a wrapped function.\n`mac(first).before(second = mac(second))`\n\n`before` does not check wether the second function is eventually called or not. use `isCalled` or an alias.\n\n### beforeReturns (other)\n\njust like `before` but checks that the function is called before the other function returns, so that it is possible for the first function to be called by the other.\n\n### returns (value)\n\nassert that a function returns a value.\nif value is a function, it will be called with the return value.\n``` js\n//assert that fun returns a string.\nmac(fun).returns(function (val) {\n  assert.equal(typeof val, 'string')\n})\n\n```\n\nthe function should throw if the return value was not valid.\n\n### isPassed (args)\n\nassert that a function is passed the correct arguments.\nif `args` is a function, that function is called as in returns.\n\n### throws (test)\n\nassert that a function throws. test may be a value or a function. `test` is optional. \n\nif supplyed `test` is called on every call.\n\n``` js \nmac(fun).throws(function (err, threw) {\n  if(threw) {\n    assert.equal(err.code,'ERRCODE') //check correct error\n  } else {\n    //what to do if there was no error?\n  }\n})\n```\nthis is useful for checking conditions about when the error should be thrown. example [stream\\#write](https://github.com/dominictarr/event-stream/blob/3f4f5cb57fb61144751ab5fe643b8974ab9007aa/test/spec.js#L32-36)\n\n### validate ()\n\ncheck all rules passed. must be called once you are sure all calls are finished.\nfor example `process.on('exit', mac.validate)` is a good time. `validate` in necessary\nto check that lower bounds of `isCalled` and aliases where met.\n\n### autoValidate()\n\ncall validate on `process.on('exit', mac.validate)`.\n\n## more coming!\n\n## license\n\nMIT / Apachce2\n","_id":"macgyver@1.9.0","dist":{"shasum":"40de72caaff410c82ec972e29c8078f51fcd6e1a","tarball":"https://registry.npmjs.org/macgyver/-/macgyver-1.9.0.tgz","integrity":"sha512-Mp6NlD1ur3AZEAhxJ5DjCWIm+ZCOo0paKLby70fsymigFUF2UY44vc6EEKvLRSybzHxPoFgZZuU91e3u5Bkq9g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICBeGANhJaTTULHxqcGg6qYqeATmJxpvCMH4qPoUN8LGAiB6xXwbGPhdtFj5re6ib5cHucbfvRlVxH0tH/IzvWF/hg=="}]},"_npmVersion":"1.1.59","_npmUser":{"name":"dominictarr","email":"dominic.tarr@gmail.com"},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{}},"1.9.1":{"name":"macgyver","version":"1.9.1","description":"[![build status](https://secure.travis-ci.org/dominictarr/macgyver.png)](http://travis-ci.org/dominictarr/macgyver)","homepage":"http://github.com/dominictarr/macgyver","repository":{"type":"git","url":"https://github.com/dominictarr/macgyver.git"},"dependencies":{},"keywords":["spec","test","order","eventually","before","critical"],"devDependencies":{"synct":"~1.0.0"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"scripts":{"test":"synct test/*.js"},"readme":"# macgyver\n\n[![build status](https://secure.travis-ci.org/dominictarr/macgyver.png)](http://travis-ci.org/dominictarr/macgyver)\n\ndeclarative assertion framework for invocation ordering.\n\nwhen evented code really gets _mission critical_ there is one man you send in...\n\nuseful for testing streams, and other complex evented modules.\n\n## example\n\n``` js\n\nvar macgyver = require('macgyver')\n\n//create a context\nvar mac = macgyver()\n\n//wrap a function...\n\nfunction hello () {\n  console.log('hello')\n}\n\nfunction goodbye () {\n  console.log('goodbye')\n}\n\nvar hi = mac(hello)\n\n//declare it's behaviours\n\nhi.isCalled(1, 7) //must be called between 1 and 7 times.\n\nvar bye = mac(goodbye).once() //must be called strictly once.\n\nhi.before(bye) //hi must be called strictly before bye is called\n\nhi(); hi(); bye()\n\n/*\n  //this will produce an error!\n  hi(); hi(); bye(); hi()\n*/\n\nmac.validate()\n```\n\nhere is a real life example: [dominictarr/event-stream/test/spec.js](https://github.com/dominictarr/event-stream/blob/3f4f5cb57fb61144751ab5fe643b8974ab9007aa/test/spec.js#L14-56)\n\n## API\n\ncreate a `maggyver` context.\n\n``` js\nvar macgyver = require('macgyver')\nvar mac = macgyver()\n\n```\n\nwrap a function \n\n``` js\n\nfunction doSomething() {}\n\nvar _doSomething = mac(doSomething)\n\n```\n\nnow, we can make declairations about how the wrapped function must be called.\n\n### isCalled(min, max)\nassert that the function is called at least `min` times, and at most `max` times.\nif `min`, or `max` is null, then that bound is not checked. i.e. `mac(fun).isCalled(null, 10)`\nwill assert that `fun` is called not more than 10 times.\n\n### once()\nalias for `isCalled (1, 1)`\n\n### times(n)\nalias for `isCalled (n, n)`\n\n### eventually()\nalias for `isCalled (null, 1)`\n\n### never()\nalias for `isCalled (0, 0)`\n\n### maybeOnce()\nalias for `isCalled (null, 1)`\n\n### atMost(max)\nalias for `isCalled (null, max)`\n\n### atLeast(min)\nalias for `isCalled (min, null)`\n\n### again (inc=1)\nincrements the number of times a function may be called.\n(inc may be negative)\n\n### before (other)\n\nassert that a function is called before another function.\nthe `other` must also be a wrapped function.\n`mac(first).before(second = mac(second))`\n\n`before` does not check wether the second function is eventually called or not. use `isCalled` or an alias.\n\n### beforeReturns (other)\n\njust like `before` but checks that the function is called before the other function returns, so that it is possible for the first function to be called by the other.\n\n### returns (value)\n\nassert that a function returns a value.\nif value is a function, it will be called with the return value.\n``` js\n//assert that fun returns a string.\nmac(fun).returns(function (val) {\n  assert.equal(typeof val, 'string')\n})\n\n```\n\nthe function should throw if the return value was not valid.\n\n### isPassed (args)\n\nassert that a function is passed the correct arguments.\nif `args` is a function, that function is called as in returns.\n\n### throws (test)\n\nassert that a function throws. test may be a value or a function. `test` is optional. \n\nif supplyed `test` is called on every call.\n\n``` js \nmac(fun).throws(function (err, threw) {\n  if(threw) {\n    assert.equal(err.code,'ERRCODE') //check correct error\n  } else {\n    //what to do if there was no error?\n  }\n})\n```\nthis is useful for checking conditions about when the error should be thrown. example [stream\\#write](https://github.com/dominictarr/event-stream/blob/3f4f5cb57fb61144751ab5fe643b8974ab9007aa/test/spec.js#L32-36)\n\n### validate ()\n\ncheck all rules passed. must be called once you are sure all calls are finished.\nfor example `process.on('exit', mac.validate)` is a good time. `validate` in necessary\nto check that lower bounds of `isCalled` and aliases where met.\n\n### autoValidate()\n\ncall validate on `process.on('exit', mac.validate)`.\n\n## more coming!\n\n## license\n\nMIT / Apachce2\n","readmeFilename":"readme.markdown","_id":"macgyver@1.9.1","dist":{"shasum":"465fecbcc3646e27221d41ae39ec6c5da6e15041","tarball":"https://registry.npmjs.org/macgyver/-/macgyver-1.9.1.tgz","integrity":"sha512-0eu1aqarLb98syfMgMszB7ap7iJKEmMHnf+qROgjUKPJ9DB1qay+CMhnkkWRsyHtdj+AJeQ0lJYqIyECq0E05g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC84vNo5TyDLAjeS/xDxa4SJFxEwPh6gXTGnp55lN4UzwIhAL9DuXW1f66ZEOeMcP/u/+HvpnFj9zhHBxlcnH6PPqjS"}]},"_npmVersion":"1.1.65","_npmUser":{"name":"dominictarr","email":"dominic.tarr@gmail.com"},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{}},"1.9.2":{"name":"macgyver","version":"1.9.2","description":"[![build status](https://secure.travis-ci.org/dominictarr/macgyver.png)](http://travis-ci.org/dominictarr/macgyver)","homepage":"http://github.com/dominictarr/macgyver","repository":{"type":"git","url":"https://github.com/dominictarr/macgyver.git"},"dependencies":{},"keywords":["spec","test","order","eventually","before","critical"],"devDependencies":{"synct":"~1.0.0"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"scripts":{"test":"synct test/*.js"},"readme":"# macgyver\n\n[![build status](https://secure.travis-ci.org/dominictarr/macgyver.png)](http://travis-ci.org/dominictarr/macgyver)\n\ndeclarative assertion framework for invocation ordering.\n\nwhen evented code really gets _mission critical_ there is one man you send in...\n\nuseful for testing streams, and other complex evented modules.\n\n## example\n\n``` js\n\nvar macgyver = require('macgyver')\n\n//create a context\nvar mac = macgyver()\n\n//wrap a function...\n\nfunction hello () {\n  console.log('hello')\n}\n\nfunction goodbye () {\n  console.log('goodbye')\n}\n\nvar hi = mac(hello)\n\n//declare it's behaviours\n\nhi.isCalled(1, 7) //must be called between 1 and 7 times.\n\nvar bye = mac(goodbye).once() //must be called strictly once.\n\nhi.before(bye) //hi must be called strictly before bye is called\n\nhi(); hi(); bye()\n\n/*\n  //this will produce an error!\n  hi(); hi(); bye(); hi()\n*/\n\nmac.validate()\n```\n\nhere is a real life example: [dominictarr/event-stream/test/spec.js](https://github.com/dominictarr/event-stream/blob/3f4f5cb57fb61144751ab5fe643b8974ab9007aa/test/spec.js#L14-56)\n\n## API\n\ncreate a `maggyver` context.\n\n``` js\nvar macgyver = require('macgyver')\nvar mac = macgyver()\n\n```\n\nwrap a function \n\n``` js\n\nfunction doSomething() {}\n\nvar _doSomething = mac(doSomething)\n\n```\n\nnow, we can make declairations about how the wrapped function must be called.\n\n### isCalled(min, max)\nassert that the function is called at least `min` times, and at most `max` times.\nif `min`, or `max` is null, then that bound is not checked. i.e. `mac(fun).isCalled(null, 10)`\nwill assert that `fun` is called not more than 10 times.\n\n### once()\nalias for `isCalled (1, 1)`\n\n### times(n)\nalias for `isCalled (n, n)`\n\n### eventually()\nalias for `isCalled (null, 1)`\n\n### never()\nalias for `isCalled (0, 0)`\n\n### maybeOnce()\nalias for `isCalled (null, 1)`\n\n### atMost(max)\nalias for `isCalled (null, max)`\n\n### atLeast(min)\nalias for `isCalled (min, null)`\n\n### again (inc=1)\nincrements the number of times a function may be called.\n(inc may be negative)\n\n### before (other)\n\nassert that a function is called before another function.\nthe `other` must also be a wrapped function.\n`mac(first).before(second = mac(second))`\n\n`before` does not check wether the second function is eventually called or not. use `isCalled` or an alias.\n\n### beforeReturns (other)\n\njust like `before` but checks that the function is called before the other function returns, so that it is possible for the first function to be called by the other.\n\n### returns (value)\n\nassert that a function returns a value.\nif value is a function, it will be called with the return value.\n``` js\n//assert that fun returns a string.\nmac(fun).returns(function (val) {\n  assert.equal(typeof val, 'string')\n})\n\n```\n\nthe function should throw if the return value was not valid.\n\n### isPassed (args)\n\nassert that a function is passed the correct arguments.\nif `args` is a function, that function is called as in returns.\n\n### throws (test)\n\nassert that a function throws. test may be a value or a function. `test` is optional. \n\nif supplyed `test` is called on every call.\n\n``` js \nmac(fun).throws(function (err, threw) {\n  if(threw) {\n    assert.equal(err.code,'ERRCODE') //check correct error\n  } else {\n    //what to do if there was no error?\n  }\n})\n```\nthis is useful for checking conditions about when the error should be thrown. example [stream\\#write](https://github.com/dominictarr/event-stream/blob/3f4f5cb57fb61144751ab5fe643b8974ab9007aa/test/spec.js#L32-36)\n\n### validate ()\n\ncheck all rules passed. must be called once you are sure all calls are finished.\nfor example `process.on('exit', mac.validate)` is a good time. `validate` in necessary\nto check that lower bounds of `isCalled` and aliases where met.\n\n### autoValidate()\n\ncall validate on `process.on('exit', mac.validate)`.\n\n## more coming!\n\n## license\n\nMIT / Apachce2\n","readmeFilename":"readme.markdown","_id":"macgyver@1.9.2","dist":{"shasum":"1ffdb75634d2e554d99bb1364fb91d59a5918e59","tarball":"https://registry.npmjs.org/macgyver/-/macgyver-1.9.2.tgz","integrity":"sha512-0wtvoMcmhRVBEzAnAZoxQ5xWIiVD4WtFVTdUc6ZpflMS/9+6HSAwVap6rLdYXqBN1ic/T7/XOHRYytF1tpcTlA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBECbevQuHmEKmCPqMilFHMi+HwoCYBpYxZQ8XJ41oEVAiEA7bmYjfmWhL9s6PvYV5XwlmrGOThEkb1geNKUtmpldag="}]},"_npmVersion":"1.1.65","_npmUser":{"name":"dominictarr","email":"dominic.tarr@gmail.com"},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{}},"1.10.0":{"name":"macgyver","version":"1.10.0","description":"[![build status](https://secure.travis-ci.org/dominictarr/macgyver.png)](http://travis-ci.org/dominictarr/macgyver)","homepage":"http://github.com/dominictarr/macgyver","repository":{"type":"git","url":"https://github.com/dominictarr/macgyver.git"},"dependencies":{},"keywords":["spec","test","order","eventually","before","critical"],"devDependencies":{"synct":"~1.0.0"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"scripts":{"test":"synct test/*.js"},"readme":"# macgyver\n\n[![build status](https://secure.travis-ci.org/dominictarr/macgyver.png)](http://travis-ci.org/dominictarr/macgyver)\n\ndeclarative assertion framework for invocation ordering.\n\nwhen evented code really gets _mission critical_ there is one man you send in...\n\nuseful for testing streams, and other complex evented modules.\n\n## example\n\n``` js\n\nvar macgyver = require('macgyver')\n\n//create a context\nvar mac = macgyver()\n\n//wrap a function...\n\nfunction hello () {\n  console.log('hello')\n}\n\nfunction goodbye () {\n  console.log('goodbye')\n}\n\nvar hi = mac(hello)\n\n//declare it's behaviours\n\nhi.isCalled(1, 7) //must be called between 1 and 7 times.\n\nvar bye = mac(goodbye).once() //must be called strictly once.\n\nhi.before(bye) //hi must be called strictly before bye is called\n\nhi(); hi(); bye()\n\n/*\n  //this will produce an error!\n  hi(); hi(); bye(); hi()\n*/\n\nmac.validate()\n```\n\nhere is a real life example: [dominictarr/event-stream/test/spec.js](https://github.com/dominictarr/event-stream/blob/3f4f5cb57fb61144751ab5fe643b8974ab9007aa/test/spec.js#L14-56)\n\n## API\n\ncreate a `maggyver` context.\n\n``` js\nvar macgyver = require('macgyver')\nvar mac = macgyver()\n\n```\n\nwrap a function \n\n``` js\n\nfunction doSomething() {}\n\nvar _doSomething = mac(doSomething)\n\n```\n\nnow, we can make declairations about how the wrapped function must be called.\n\n### isCalled(min, max)\nassert that the function is called at least `min` times, and at most `max` times.\nif `min`, or `max` is null, then that bound is not checked. i.e. `mac(fun).isCalled(null, 10)`\nwill assert that `fun` is called not more than 10 times.\n\n### once()\nalias for `isCalled (1, 1)`\n\n### times(n)\nalias for `isCalled (n, n)`\n\n### eventually()\nalias for `isCalled (null, 1)`\n\n### never()\nalias for `isCalled (0, 0)`\n\n### maybeOnce()\nalias for `isCalled (null, 1)`\n\n### atMost(max)\nalias for `isCalled (null, max)`\n\n### atLeast(min)\nalias for `isCalled (min, null)`\n\n### again (inc=1)\nincrements the number of times a function may be called.\n(inc may be negative)\n\n### before (other)\n\nassert that a function is called before another function.\nthe `other` must also be a wrapped function.\n`mac(first).before(second = mac(second))`\n\n`before` does not check wether the second function is eventually called or not. use `isCalled` or an alias.\n\n### beforeReturns (other)\n\njust like `before` but checks that the function is called before the other function returns, so that it is possible for the first function to be called by the other.\n\n### returns (value)\n\nassert that a function returns a value.\nif value is a function, it will be called with the return value.\n``` js\n//assert that fun returns a string.\nmac(fun).returns(function (val) {\n  assert.equal(typeof val, 'string')\n})\n\n```\n\nthe function should throw if the return value was not valid.\n\n### isPassed (args)\n\nassert that a function is passed the correct arguments.\nif `args` is a function, that function is called as in returns.\n\n### throws (test)\n\nassert that a function throws. test may be a value or a function. `test` is optional. \n\nif supplyed `test` is called on every call.\n\n``` js \nmac(fun).throws(function (err, threw) {\n  if(threw) {\n    assert.equal(err.code,'ERRCODE') //check correct error\n  } else {\n    //what to do if there was no error?\n  }\n})\n```\nthis is useful for checking conditions about when the error should be thrown. example [stream\\#write](https://github.com/dominictarr/event-stream/blob/3f4f5cb57fb61144751ab5fe643b8974ab9007aa/test/spec.js#L32-36)\n\n### validate ()\n\ncheck all rules passed. must be called once you are sure all calls are finished.\nfor example `process.on('exit', mac.validate)` is a good time. `validate` in necessary\nto check that lower bounds of `isCalled` and aliases where met.\n\n### autoValidate(browserTimeout)\n\ncall validate on `process.on('exit', mac.validate)`.\nif process.on is not available (as on the browser) wait until `browserTimeout` instead.\n[testling ci](http://ci.testling.com) kills tests after 30 seconds, so by default\n`browserTimeout = 10e3` (10 seconds)\n\n## more coming!\n\n## license\n\nMIT / Apachce2\n","readmeFilename":"readme.markdown","_id":"macgyver@1.10.0","dist":{"shasum":"65e693f5278c133cd8b350c73c9624b2438860f0","tarball":"https://registry.npmjs.org/macgyver/-/macgyver-1.10.0.tgz","integrity":"sha512-BIoNGmbPz9R8wawXOrGEsughJj9Asylutjs6TROs723WafLIBtDto2dCipRzxh3PDRKx4ftey0Xu7rfRiF9EBA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDRhb/kk8fRvHlYWRLZP2T/FJaU1odP/9j+Dp/1sJTpVwIgZe0c6tw0jtjrMz9WmgYKyhYkt98Orv+U7ai7ZqVxHFI="}]},"_npmVersion":"1.1.65","_npmUser":{"name":"dominictarr","email":"dominic.tarr@gmail.com"},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{}},"1.10.1":{"name":"macgyver","version":"1.10.1","description":"[![build status](https://secure.travis-ci.org/dominictarr/macgyver.png)](http://travis-ci.org/dominictarr/macgyver) [![browser status](http://ci.testling.com/dominictarr/macgyver.png)](http://ci.testling.com/dominictarr/macgyver) declarative assertion framework for invocation ordering.","homepage":"http://github.com/dominictarr/macgyver","repository":{"type":"git","url":"https://github.com/dominictarr/macgyver.git"},"dependencies":{},"keywords":["spec","test","order","eventually","before","critical"],"devDependencies":{"synct":"~1.0.0"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"scripts":{"test":"synct test/*.js"},"readme":"# macgyver\n\n[![build status](https://secure.travis-ci.org/dominictarr/macgyver.png)](http://travis-ci.org/dominictarr/macgyver)\n[![browser status](http://ci.testling.com/dominictarr/macgyver.png)](http://ci.testling.com/dominictarr/macgyver)\ndeclarative assertion framework for invocation ordering.\n\nwhen evented code really gets _mission critical_ there is one man you send in...\n\nuseful for testing streams, and other complex evented modules.\n\n## example\n\n``` js\n\nvar macgyver = require('macgyver')\n\n//create a context\nvar mac = macgyver()\n\n//wrap a function...\n\nfunction hello () {\n  console.log('hello')\n}\n\nfunction goodbye () {\n  console.log('goodbye')\n}\n\nvar hi = mac(hello)\n\n//declare it's behaviours\n\nhi.isCalled(1, 7) //must be called between 1 and 7 times.\n\nvar bye = mac(goodbye).once() //must be called strictly once.\n\nhi.before(bye) //hi must be called strictly before bye is called\n\nhi(); hi(); bye()\n\n/*\n  //this will produce an error!\n  hi(); hi(); bye(); hi()\n*/\n\nmac.validate()\n```\n\nhere is a real life example: [dominictarr/event-stream/test/spec.js](https://github.com/dominictarr/event-stream/blob/3f4f5cb57fb61144751ab5fe643b8974ab9007aa/test/spec.js#L14-56)\n\n## API\n\ncreate a `maggyver` context.\n\n``` js\nvar macgyver = require('macgyver')\nvar mac = macgyver()\n\n```\n\nwrap a function \n\n``` js\n\nfunction doSomething() {}\n\nvar _doSomething = mac(doSomething)\n\n```\n\nnow, we can make declairations about how the wrapped function must be called.\n\n### isCalled(min, max)\nassert that the function is called at least `min` times, and at most `max` times.\nif `min`, or `max` is null, then that bound is not checked. i.e. `mac(fun).isCalled(null, 10)`\nwill assert that `fun` is called not more than 10 times.\n\n### once()\nalias for `isCalled (1, 1)`\n\n### times(n)\nalias for `isCalled (n, n)`\n\n### eventually()\nalias for `isCalled (null, 1)`\n\n### never()\nalias for `isCalled (0, 0)`\n\n### maybeOnce()\nalias for `isCalled (null, 1)`\n\n### atMost(max)\nalias for `isCalled (null, max)`\n\n### atLeast(min)\nalias for `isCalled (min, null)`\n\n### again (inc=1)\nincrements the number of times a function may be called.\n(inc may be negative)\n\n### before (other)\n\nassert that a function is called before another function.\nthe `other` must also be a wrapped function.\n`mac(first).before(second = mac(second))`\n\n`before` does not check wether the second function is eventually called or not. use `isCalled` or an alias.\n\n### beforeReturns (other)\n\njust like `before` but checks that the function is called before the other function returns, so that it is possible for the first function to be called by the other.\n\n### returns (value)\n\nassert that a function returns a value.\nif value is a function, it will be called with the return value.\n``` js\n//assert that fun returns a string.\nmac(fun).returns(function (val) {\n  assert.equal(typeof val, 'string')\n})\n\n```\n\nthe function should throw if the return value was not valid.\n\n### isPassed (args)\n\nassert that a function is passed the correct arguments.\nif `args` is a function, that function is called as in returns.\n\n### throws (test)\n\nassert that a function throws. test may be a value or a function. `test` is optional. \n\nif supplyed `test` is called on every call.\n\n``` js \nmac(fun).throws(function (err, threw) {\n  if(threw) {\n    assert.equal(err.code,'ERRCODE') //check correct error\n  } else {\n    //what to do if there was no error?\n  }\n})\n```\nthis is useful for checking conditions about when the error should be thrown. example [stream\\#write](https://github.com/dominictarr/event-stream/blob/3f4f5cb57fb61144751ab5fe643b8974ab9007aa/test/spec.js#L32-36)\n\n### validate ()\n\ncheck all rules passed. must be called once you are sure all calls are finished.\nfor example `process.on('exit', mac.validate)` is a good time. `validate` in necessary\nto check that lower bounds of `isCalled` and aliases where met.\n\n### autoValidate(browserTimeout)\n\ncall validate on `process.on('exit', mac.validate)`.\nif process.on is not available (as on the browser) wait until `browserTimeout` instead.\n[testling ci](http://ci.testling.com) kills tests after 30 seconds, so by default\n`browserTimeout = 10e3` (10 seconds)\n\n## more coming!\n\n## license\n\nMIT / Apachce2\n","readmeFilename":"readme.markdown","_id":"macgyver@1.10.1","dist":{"shasum":"b09d1599d8b36ed5b16f59589515d9d14bc2fd88","tarball":"https://registry.npmjs.org/macgyver/-/macgyver-1.10.1.tgz","integrity":"sha512-grTY6JMZd8ODxILxRO75th5gajL0IANjCI7Aek5q2UTFWlb1m8wq8gxrIHL55WuxnivC1wU0oFVc5IFm435ERQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD1IqE0pbXw0kOIW0a+2SCI/Ca8R2aE8DJkiV4tM5KN3QIhANZHqZDttxjsKPvGxpsCNNmtSKAinpb4A2Dae4HPcYdf"}]},"_npmVersion":"1.1.69","_npmUser":{"name":"dominictarr","email":"dominic.tarr@gmail.com"},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{}}},"maintainers":[{"email":"nopersonsmodules@gmail.com","name":"nopersonsmodules"}],"time":{"modified":"2022-06-19T15:03:47.676Z","created":"2011-09-14T06:16:01.268Z","0.0.0":"2011-09-14T06:16:04.646Z","1.0.0":"2012-06-27T11:46:06.640Z","1.2.0":"2012-06-28T10:42:44.707Z","1.3.0":"2012-06-28T16:34:11.111Z","1.4.0":"2012-06-30T11:59:22.143Z","1.5.0":"2012-06-30T12:10:38.451Z","1.6.0":"2012-07-04T05:49:12.771Z","1.6.1":"2012-07-04T14:02:15.384Z","1.6.2":"2012-07-04T17:04:04.553Z","1.6.3":"2012-07-11T05:17:51.078Z","1.7.0":"2012-08-15T19:40:49.020Z","1.8.0":"2012-08-24T16:41:47.692Z","1.8.1":"2012-10-26T15:56:59.112Z","1.8.2":"2012-10-26T16:06:48.719Z","1.9.0":"2012-10-30T17:09:46.023Z","1.9.1":"2012-11-18T06:33:46.313Z","1.9.2":"2012-11-18T06:49:20.044Z","1.10.0":"2012-12-13T00:34:33.853Z","1.10.1":"2012-12-22T00:59:06.289Z"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"repository":{"type":"git","url":"https://github.com/dominictarr/macgyver.git"},"users":{"wenbing":true}}