0.0.1 • Published 8 years ago

stuba v0.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
8 years ago

stuba Build Status JavaScript Style Guide

super simple stupid™ stubs

installation

$ yarn add stuba --dev

api

s = stuba([fn], [stubFn])

Stub out the given [fn] if any. If no [stubFn] is supplied, the original [fn] will be called. All calls are recorded. Returns whatever [stubFn] or [fn] returns.

s.called(n)

Returns true/false if the call count matches n.

const s = stuba()
s()
s.called(1) // true

s.call(nth)

Return the nth call.

const s = stuba()
s('a')
s('b')
s('c')
s.call(0).args // ['a']
s.call(1).args // ['b']
s.call(2).args // ['c']

// get the last call
s.call(-1).args // ['c']

license

mit

0.0.1

8 years ago