substantial / sinon-stub-promise

Synchronous Promise stubbing for Sinon.JS
MIT License
85 stars 11 forks source link

Incompatible with sinon 5.0 #30

Open senseysensor opened 6 years ago

senseysensor commented 6 years ago

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

colinrotherham commented 6 years ago

@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?

jpecht-jumpcloud commented 6 years ago

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

tsneed290 commented 5 years ago

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

colinrotherham commented 5 years ago

@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.

tsneed290 commented 5 years ago

@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.

antunesgabriel commented 5 years ago

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

cassmtnr commented 3 years ago

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