ciena-blueplanet / ember-test-utils

A set of utilities to aid in testing components
MIT License
5 stars 18 forks source link

Evaluate whether returnPromiseFromStub() is needed now that sinon.js provides similar #57

Open notmessenger opened 7 years ago

notmessenger commented 7 years ago

returnPromiseFromStub in addon-test-support/stub.js

http://sinonjs.org/releases/v2.2.0/stubs/

job13er commented 7 years ago

I don't think those sinon methods let you control when the promise resolves/rejects, do they?

Not sure about anyone else, but I always explicitly trigger the resolve/reject in a separate beforeEach from where the promise was returned, so I can check for things that should be happening between when the promise is returned and when it resolves/rejects.

job13er commented 7 years ago

That being said, I can create a helper somewhere else, as it's got nothing to do with ember, that creates the resolver that returnPromiseFromStub() creates, and we can use sinon's .returns() to return the resolver.promise and still achieve the same thing, so I don't mind getting rid of returnsPromiseFromStub() in the next major release.