FirebaseExtended / angularfire

AngularJS bindings for Firebase
MIT License
2.73k stars 631 forks source link

Add tests for _initAuthResolver in FirebaseAuth #950

Closed PezCoder closed 6 years ago

PezCoder commented 7 years ago

Description

src/auth/FirebaseAuth.js contains a function named _initAuthResolver This pr adds unit test cases for _initAuthResolver function. Reference: https://github.com/firebase/angularfire/issues/951

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 93.852% when pulling b346d24f0e670131f253776ec6d2b7ca790c1dbb on PezCoder:tests/_initAuthResolver into b6dca6ea5a81b3edd44230fb1cb6ca62419f1926 on firebase:master.

PezCoder commented 7 years ago

Not sure why the travis is breaking, My observations for the second test:

  1. ctx._initAuthResolver() will invoke auth.onAuthStateChanged internally with a callback to resolve the promise returned by _initAuthResolver function
  2. Also our spy should be triggered & fakePromiseResolve should now contain a function calling which should call the above callback
  3. Calling fakePromiseResolve & Promise should be resolved & expect should be checked, done should let the jasmine know that the task is done.

It's running fine locally but not on travis, maybe it's not resolving on travis. Am I missing something ? 🤔

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 93.852% when pulling 7ab47ede933dc94257ec355a2d56f25b0144016d on PezCoder:tests/_initAuthResolver into b6dca6ea5a81b3edd44230fb1cb6ca62419f1926 on firebase:master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 93.852% when pulling de454f7cc86311c00feaa1a584d23e1eb47c12d4 on PezCoder:tests/_initAuthResolver into b6dca6ea5a81b3edd44230fb1cb6ca62419f1926 on firebase:master.

PezCoder commented 7 years ago

The newly added tests are passing as expected now, after i added tick() method at last. 😄 Buy how ? Also other tests that are not related to my pr are breaking.