Skip to content

Instantly share code, notes, and snippets.

@simonrenoult
Created October 21, 2016 08:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonrenoult/449fb64da818da86d79b01cfbb948cc9 to your computer and use it in GitHub Desktop.
Save simonrenoult/449fb64da818da86d79b01cfbb948cc9 to your computer and use it in GitHub Desktop.
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