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

Preliminary tests for $firebaseAuth #470

Merged
merged 20 commits into from
Dec 5, 2014

Conversation

jamestalmage
Copy link
Contributor

I took a stab at it. Let me know what you think.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 5b462a1 on jamestalmage:firebase-auth-tests into * on firebase:master*.

@jamestalmage
Copy link
Contributor Author

This only covers half the class (those methods deferring to _onLoginHandler).
I can flush it out to cover the rest of the class, but I wanted a project collaborator to approve before I spent more time.

@jwngr
Copy link

jwngr commented Nov 20, 2014

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!

@jwngr
Copy link

jwngr commented Nov 26, 2014

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
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 6c80065 on jamestalmage:firebase-auth-tests into * on firebase:master*.

Tests for `$getAuth()`, `$unauth`, and `$onAuth`.
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 9fb6bec on jamestalmage:firebase-auth-tests into * on firebase:master*.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling a6b1a8a on jamestalmage:firebase-auth-tests into * on firebase:master*.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling bb451be on jamestalmage:firebase-auth-tests into * on firebase:master*.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 4fdff7b on jamestalmage:firebase-auth-tests into * on firebase:master*.

@jamestalmage
Copy link
Contributor Author

@jwngr @katowulf
100% coverage of FirebaseAuth.js.

@jwngr
Please review and merge at your convenience.

inject(function(_$firebaseAuth_,_$timeout_){
$firebaseAuth = _$firebaseAuth_;
auth = $firebaseAuth(ref);
$timeout = _$timeout_;
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

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.

@katowulf
Copy link
Contributor

katowulf commented Dec 1, 2014

@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
Copy link
Contributor Author

@jwngr @katowulf
Made the changes, should be good to go.

@katowulf
Copy link
Contributor

katowulf commented Dec 4, 2014

@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.

@jamestalmage
Copy link
Contributor Author

No problem. Recent merges required additional tests anyways.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 0812dd3 on jamestalmage:firebase-auth-tests into b512baa on firebase:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) when pulling 88066b7 on jamestalmage:firebase-auth-tests into b512baa on firebase:master.

describe('$authWithPassword',function(){
it('passes options and credentials object to underlying method',function(){
var options = {someOption:'a'};
var credentials = {username:'myname',password:'password'};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

username -> email

@jwngr
Copy link

jwngr commented Dec 5, 2014

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 master. We are probably going to cut a new release soon to get all the awesome changes you've introduced out to the public.

@jwngr jwngr assigned jamestamplin and unassigned jamestamplin Dec 5, 2014
@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling e733955 on jamestalmage:firebase-auth-tests into b512baa on firebase:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling b5750b4 on jamestalmage:firebase-auth-tests into b512baa on firebase:master.

…mat.

In all tests except those specifically testing deprecated behavior,
use the correct argument format.
@jwngr
Copy link

jwngr commented Dec 5, 2014

You've got one last typo which is causing the tests to fail. Once that's fixed, this thing is gonna be merged!

@jamestalmage
Copy link
Contributor Author

@jwngr
Typo fixed. Sorry should have ran tests before committing.
I also just changed all the test methods to use the non-deprecated calls (except those explicitly testing deprecated behavior)

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling b985a4c on jamestalmage:firebase-auth-tests into b512baa on firebase:master.

@jwngr
Copy link

jwngr commented Dec 5, 2014

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 authWithOAuthToken() docs. That's what I get for rearranging lines...

jwngr pushed a commit that referenced this pull request Dec 5, 2014
Preliminary tests for $firebaseAuth
@jwngr jwngr merged commit 18db305 into FirebaseExtended:master Dec 5, 2014
@jamestalmage jamestalmage deleted the firebase-auth-tests branch December 5, 2014 06:48
@jamestalmage
Copy link
Contributor Author

Thank you for the kind words.

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

Successfully merging this pull request may close these issues.

None yet

6 participants