Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add promise helpers #11

Open
tandrewnichols opened this issue May 25, 2016 · 3 comments
Open

Add promise helpers #11

tandrewnichols opened this issue May 25, 2016 · 3 comments

Comments

@tandrewnichols
Copy link

tandrewnichols commented May 25, 2016

I hate stubbing promises. It would be sweet if this lib would let me do:

var spy = jasmine.createSpy('some spy');
spy.when('foo').thenResolvePromiseWith({ fruit: 'banana' });

// Then later
spy('foo').then(otherSpy)

Where the implementation is something like:

function(thing) {
  var promise = new Promise(function(resolve, reject) {
    resolve(thing);
  });
  return promise;
}

And obviously, a corresponding thenRejectPromiseWith.

@searls
Copy link
Owner

searls commented May 26, 2016

Why don't i introduce you to this thing that I actually maintain now! https://github.com/testdouble/testdouble.js

We have an issue for this: testdouble/testdouble.js#46

@tandrewnichols
Copy link
Author

Ok, I'm interested, although I think migration from jasmine + jasmine-stealth (etc.) might be a challenging undertaking.

@searls
Copy link
Owner

searls commented May 26, 2016

td.js can work in concert with Jasmine just fine (though I'd mark which tests use Jasmine spies and which us td.js). I'd recommend just trying it on a test-by-test basis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants