Promises not resolving with Jasmine/Karma test
See original GitHub issuePromises resolve fine when run normally, but don’t resolve at all when run as part of a karma/jasmine test. .then
calls (even in the controller) don’t run.
Issue Analytics
- State:
- Created 9 years ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Jasmine test a promise.then function - Stack Overflow
One approach I've found useful when testing is mocking dependencies. ... promise deferred.resolve(123); // Note that the 'then' function does not get called ......
Read more >Unit Testing Async Calls and Promises with Jasmine - Medium
Promises can often be puzzling to test due to their asynchronous nature. After looking at Jasmine documentation, you may be thinking there's got...
Read more >Promises not resolving with Jasmine/Karma test #318 - GitHub
The issue is getting a callback when the Firebase data returns. The promise handlers need to be flushed manually under test and you...
Read more >Angular Unit Testing Promise All | Karma | Jasmine - YouTube
karma #angular #unit testingHow to unit test promise.all in Angular. Unit testing Asynchronous Call in Angular.In this video, you'll learn ...
Read more >Frequently Asked Questions - Jasmine Documentation
How do I test async behavior that I don't have a promise or callback for, like a UI component that renders something after...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Since Angular uses mocks, pretty much everything has to be flushed by hand. AngularFire depends on
$timeout
internally, so that has to get flushed any time an angularFire op is expected. Most of the AngularFire tests do something like this:That may help a bit.
Thanks guys. This helped my understanding a lot. Looks like I’ve got some hackarounds to code.