1 | import _ from './wrap/lodash'
|
2 | import create from './matchers/create'
|
3 |
|
4 | const callback = create({
|
5 | name: 'callback',
|
6 | matches (matcherArgs, actual) {
|
7 | return _.isFunction(actual)
|
8 | },
|
9 | onCreate (matcherInstance, matcherArgs) {
|
10 | matcherInstance.args = matcherArgs
|
11 | matcherInstance.__testdouble_callback = true
|
12 | }
|
13 | })
|
14 |
|
15 | // Make callback itself quack like a matcher for its non-invoked use case.
|
16 | callback.__name = 'callback'
|
17 | callback.__matches = _.isFunction
|
18 |
|
19 | export default callback
|