-
Notifications
You must be signed in to change notification settings - Fork 632
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
Preliminary tests for $firebaseAuth #470
Preliminary tests for $firebaseAuth #470
Conversation
Changes Unknown when pulling 5b462a1 on jamestalmage:firebase-auth-tests into * on firebase:master*. |
This only covers half the class (those methods deferring to |
Thanks for the contribution! I realistically won't have a chance to play with/look into this PR for a couple days due to my schedule, but I will definitely get back to you as soon as I can. Keep up the awesome work! |
Hey @jamestalmage - apologies on the delayed review on this PR. Overall, I think it has some great stuff and urge you to continue pumping out more tests if you are up for it! My major comment would be that long-term, I think we will want to add the new authentication methods to MockFirebase and use those mocked methods in this AngularFire test suite. But I would be more than happy to merge in your test suite in the meantime if you want to keep going. This puts us 80% of the way to a final solution (if not more). |
Commit @239e2de added an option options argument to authWithCustomToken. This caused a test failure. Change tests to reflect new API.
Delete extra whitespace
Changes Unknown when pulling 6c80065 on jamestalmage:firebase-auth-tests into * on firebase:master*. |
Tests for `$getAuth()`, `$unauth`, and `$onAuth`.
Changes Unknown when pulling 9fb6bec on jamestalmage:firebase-auth-tests into * on firebase:master*. |
Changes Unknown when pulling a6b1a8a on jamestalmage:firebase-auth-tests into * on firebase:master*. |
Changes Unknown when pulling bb451be on jamestalmage:firebase-auth-tests into * on firebase:master*. |
Changes Unknown when pulling 4fdff7b on jamestalmage:firebase-auth-tests into * on firebase:master*. |
@jwngr @katowulf @jwngr |
inject(function(_$firebaseAuth_,_$timeout_){ | ||
$firebaseAuth = _$firebaseAuth_; | ||
auth = $firebaseAuth(ref); | ||
$timeout = _$timeout_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just intellectualizing here: I've started to prefer setting this.$timeout
vs a global var $timeout
and the _$timeout_
notation. Since we're in a beforeEach, this.$timeout
is available in every scope and doesn't interfere with any other global variables set in the scope chain (a problem I've run into a few times in test units with commonly named variables, not specifically with $
services from angular).
I haven't made this suggestion for AngularFire specifically and we may keep the current convention for convenience; again, just intellectualizing about the cooking apparatus.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@katowulf The reason not to use that convention is that it's cumbersome to constantly be passing this
around when you have tests with callbacks. I used to store test data on this
and dropped the habit because constant self = this
or binding was sloppier than the scope hoisting method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I haven't run into passing it around via callbacks yet. Great point.
@jamestalmage great work! Some minor stylistic comments to consider; let me know when you've looked them over and we'll be good to merge. I'll leave the actual merging for @jwngr since this is his purview. |
@jamestalmage we're just waiting on @jwngr to get some free time. Think of me like a copper alloy and Jacob like about three pounds of neodymium. In other words, it can be hard to get enough of him in one place at any given time. |
No problem. Recent merges required additional tests anyways. |
It no longer fails, but there is still an issue.
describe('$authWithPassword',function(){ | ||
it('passes options and credentials object to underlying method',function(){ | ||
var options = {someOption:'a'}; | ||
var credentials = {username:'myname',password:'password'}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
username -> email
I'm not sure I really followed @katowulf's analogy, but thanks for your patience here @jamestalmage! I made a few final comments (nothing too big) and once you clean those up, this thing will get merged into |
…mat. In all tests except those specifically testing deprecated behavior, use the correct argument format.
You've got one last typo which is causing the tests to fail. Once that's fixed, this thing is gonna be merged! |
@jwngr |
Merging in! This is some really fantastic work and it is extremely appreciated! You're killing it! I also just sent a PR to get that typo fixed in our |
Preliminary tests for $firebaseAuth
Thank you for the kind words. |
I took a stab at it. Let me know what you think.