{"maintainers":[{"name":"anonymous","email":"cjihrig@gmail.com"}],"keywords":["call","must call","will call","should call","assert","expect"],"dist-tags":{"latest":"1.0.1"},"author":{"name":"Continuation Labs","email":"contact@continuation.io","url":"http://continuation.io/"},"description":"check that expected function calls are actually made","readme":"# will-call\n\n[![Current Version](https://img.shields.io/npm/v/will-call.svg)](https://www.npmjs.org/package/will-call)\n[![Build Status via Travis CI](https://travis-ci.org/continuationlabs/will-call.svg?branch=master)](https://travis-ci.org/continuationlabs/will-call)\n![Dependencies](http://img.shields.io/david/continuationlabs/will-call.svg)\n\n[![belly-button-style](https://cdn.rawgit.com/continuationlabs/belly-button/master/badge.svg)](https://github.com/continuationlabs/belly-button)\n\n**Credit:** This module borrows heavily from the `common.mustCall()` functionality in Node core's test suite.\n\n`will-call` allows you to mark functions that should be executed. You can later check which functions were actually called.\n\n```javascript\nconst WillCall = require('will-call');\nconst wc = new WillCall();\nconst foo = wc.expect(function foo () { return 'foo'; });     // must be called once\nconst bar = wc.expect(function bar () { return 'bar'; }, 2);  // must be called twice\nconst baz = wc.expect(function baz () { return 'baz'; });     // must be called once\n\nfoo();\nbar();\nbaz();\nbaz();\n\nconst results = wc.check();\n// results contains an array of length two, corresponding to bar() and baz()\n// Each entry provides the function name, a stack, expected calls, and actual calls\n```\n\n## Methods\n\n`will-call` exports a constructor function that takes no arguments. Constructed instances support the following methods.\n\n### `WillCall.prototype.expect(fn [, expected])`\n\n  - Arguments\n    - `fn` (function) - The function that is expected to be called.\n    - `expected` (integer) - The exact number of times that `fn` should be called. If a non-negative integer is not received, this defaults to 1. Optional.\n  - Returns\n    - A wrapped version of `fn`. The wrapped function should behave the same as `fn`.\n\nThis function specifies the exact number of times that a given function is expected to be called. `expect()` returns a wrapped version of the `fn` argument. It is important that the wrapped function be used instead of the original `fn` function.\n\n### `WillCall.prototype.check()`\n\n  - Arguments\n    - None\n  - Returns\n    - Array of objects. Each object adheres to the following schema.\n      - `name` (string) - The name of the function, or `'<anonymous>'` if the function doesn't have a name.\n      - `expected` (integer) - The number of times the function was expected to be called.\n      - `actual` (integer) - The number of times the function was actually called.\n      - `stack` (string) - A partial stack trace identifying where the function was passed to `expect()`.\n\nThis function verifies that all expected functions were called the correct number of times. `check()` returns an array identifying the functions that were **not** called correctly. This function does not alter any internal state, and can be called multiple times.\n","repository":{"type":"git","url":"git+https://github.com/continuationlabs/will-call.git"},"bugs":{"url":"https://github.com/continuationlabs/will-call/issues"},"license":"MIT","versions":{"1.0.0":{"name":"will-call","version":"1.0.0","description":"check that expected function calls are actually made","author":{"name":"Continuation Labs","email":"contact@continuation.io","url":"http://continuation.io/"},"main":"lib/index.js","homepage":"https://github.com/continuationlabs/will-call","repository":{"type":"git","url":"git+https://github.com/continuationlabs/will-call.git"},"bugs":{"url":"https://github.com/continuationlabs/will-call/issues"},"license":"MIT","scripts":{"lint":"belly-button -f","test":"npm run lint && lab -v -a code -c"},"devDependencies":{"belly-button":"2.0.1","code":"2.1.1","lab":"10.3.0"},"keywords":["call","must call","will call","should call","assert","expect"],"gitHead":"ebb617798302ddf4d150f3d4fbbeb31d2fe3eccb","_id":"will-call@1.0.0","_shasum":"398cff00082e051c2da01cc9f52937ad935524a4","_from":".","_npmVersion":"3.8.3","_nodeVersion":"5.7.0","_npmUser":{"name":"anonymous","email":"cjihrig@gmail.com"},"dist":{"shasum":"398cff00082e051c2da01cc9f52937ad935524a4","tarball":"http://repository.ncinga.com/nexus/content/repositories/npm-js-registry/will-call/-/will-call-1.0.0.tgz","integrity":"sha512-Xb/a/TFMQCqQGauGOIvH8ZBOdY0iMosFfBg83JAkjb7GWWHrbSmFRuVczYfmJKM9LK54+XKkji4HX16g+8wShw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCru+lUWzz5+DzbzAu8bs5+7ynxnbDr5sserA/NE9GzsQIgA5CiSXzW5oTPds8zaTQNrCuVaMBhiOWKKFtgYTYLxv0="}]},"maintainers":[{"name":"anonymous","email":"cjihrig@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/will-call-1.0.0.tgz_1459195111899_0.05263947602361441"}},"1.0.1":{"name":"will-call","version":"1.0.1","description":"check that expected function calls are actually made","author":{"name":"Continuation Labs","email":"contact@continuation.io","url":"http://continuation.io/"},"main":"lib/index.js","homepage":"https://github.com/continuationlabs/will-call","repository":{"type":"git","url":"git+https://github.com/continuationlabs/will-call.git"},"bugs":{"url":"https://github.com/continuationlabs/will-call/issues"},"license":"MIT","scripts":{"lint":"belly-button -f","test":"npm run lint && lab -v -a code -c -m 10000"},"devDependencies":{"belly-button":"4.x.x","code":"5.x.x","lab":"15.x.x"},"keywords":["call","must call","will call","should call","assert","expect"],"gitHead":"38453cc65023d10dd424f7bdbd7e3f99e0d114cf","_id":"will-call@1.0.1","_npmVersion":"5.4.2","_nodeVersion":"8.8.1","_npmUser":{"name":"anonymous","email":"cjihrig@gmail.com"},"dist":{"integrity":"sha512-1hEeV8SfBYhNRc/bNXeQfyUBX8Dl9SCYME3qXh99iZP9wJcnhnlBsoBw8Y0lXVZ3YuPsoxImTzBiol1ouNR/hg==","shasum":"9b37561ea7156aaba21b28fdf635b80fe78bf166","tarball":"http://repository.ncinga.com/nexus/content/repositories/npm-js-registry/will-call/-/will-call-1.0.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDyCbZd3aUZvVFl2/c146OEBRHEbT3b6uo5ulsYXXPyawIgT9vHo70RKxDGIi08M42LVfXiULrUs9rx9f542Q95yQs="}]},"maintainers":[{"name":"anonymous","email":"cjihrig@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/will-call-1.0.1.tgz_1510240584726_0.49613498733378947"}}},"name":"will-call","time":{"modified":"2022-06-29T01:57:37.757Z","created":"2016-03-28T19:58:32.897Z","1.0.0":"2016-03-28T19:58:32.897Z","1.0.1":"2017-11-09T15:16:25.678Z"},"readmeFilename":"README.md","homepage":"https://github.com/continuationlabs/will-call"}