-
Notifications
You must be signed in to change notification settings - Fork 934
Initial auth object implementation + initializeAuth() #2932
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
Conversation
9d9552e
to
519374a
Compare
|
||
// This promise is intended to float; auth initialization happens in the | ||
// background, meanwhile the auth object may be used by the app. | ||
// eslint-disable-next-line @typescript-eslint/no-floating-promises |
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.
will this still call the promise? is there a way to test that?
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.
It will, promises always execute. There's no concept of "hot" and "cold" promises like there are with observables. Since this.operations is initialized as Promise.resolve()
, and queue()
just puts the callback in a .then()
, the initial promise is resolved and so the callback here will immediately execute.
There's not really a way to test that it runs on its own since the test has to await
something, but my tests do cover this code by awaiting a later operation (but note it's not the act of awaiting that triggers this code to run)
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.
💯
import * as sinon from 'sinon'; | ||
import * as sinonChai from 'sinon-chai'; | ||
|
||
import { FirebaseApp } from '@firebase/app-types'; |
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.
Should reference types in @firebase/app-types-exp
instead.
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.
Oops, done
@@ -31,6 +31,15 @@ export interface Config { | |||
} | |||
|
|||
export interface Auth { |
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.
Will the public types eventually be moved to @firebase/auth-types-exp
?
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.
Yeah, the files in the model/ directory are meant to contain internal stuff as well. The types in the types package will expose only the public bits (and many of the fields will be marked as readonly, for example)
da779cf
to
1af71dd
Compare
No description provided.