substantial/sinon-stub-promise

Incompatible with sinon 5.0

senseysensor opened this issue · 7 comments

sinon.stub().returnsPromise() – no such method.
everything is ok with sinon 4.5.

@senseysensor Every sinon.stub() supports .resolves() and .rejects() already.

You don't need sinon-stub-promise anymore:
http://sinonjs.org/releases/v5.0.9/stubs/

Hope this helps?

I believe sinon doesn't support stubbing Promises to evaluate synchronously however.

@colinrotherham This library stubs the Promises synchronously. sinon.stub().resolves() does not resolve the Promise synchronously.

@tsneed290 It does yeah, but you'll likely want to improve your tests use the sinon.stub() .resolves() and .rejects() methods to match native asynchronous promises.

Otherwise you're producing test stubs that behave far differently to your real code.

@colinrotherham That's actually what I'm doing now. I've found better ways to handle these async actions (redux thunk and async componentDidMount patterns) without needing this library.

SpotifyWrapper
Generic search method
"before each" hook for "should call fetch promise":
TypeError: fetchedStub.returnsPromise is not a function
Captura de Tela_20190325203002
Captura de Tela_20190325203002

SpotifyWrapper
Generic search method
"before each" hook for "should call fetch promise":
TypeError: fetchedStub.returnsPromise is not a function

@antunesgabriel how you solved?
@antunesgabriel como tu resolveu?