Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const sinon = require('sinon')
const chai = require('chai')
const expect = chai.expect
const foo = callback => {
return Promise.resolve().then(() => {
setTimeout(() => {
callback()
}, 5000)
})
}
describe('foo', () => {
describe('when promise is not returned', () => {
const spy = sinon.spy()
before(() => {
foo(spy) // not returned
})
it('should not call the callback', () => {
expect(spy.called).to.be.false
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment