1.0.0 • Published 11 months ago
nanospy v1.0.0
Nano Spy
A tiny Node.js library to spy and mock methods in tests with great TypeScript support.
It will take only 6 KB
in your node_modules
and have 0 dependencies.
import { spyOn, restoreAll } from 'nanospy'
test.after.each(() => {
restoreAll()
})
test('calls increase', () => {
const spy = spyOn(counter, 'increase')
counter.increase(5)
assert.equal(spy.callCount, 1)
assert.equal(spy.calls, [[5]])
})
Docs
Read full docs here.