UNPKG

490 BJavaScriptView Raw
1import _ from './wrap/lodash'
2import create from './matchers/create'
3
4const 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.
16callback.__name = 'callback'
17callback.__matches = _.isFunction
18
19export default callback