Skip to content

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

Merged
merged 7 commits into from
Apr 22, 2020

Conversation

sam-gc
Copy link
Contributor

@sam-gc sam-gc commented Apr 17, 2020

No description provided.

@sam-gc sam-gc requested review from avolkovi and scottcrossen April 17, 2020 22:41
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Apr 17, 2020

Binary Size Report

Affected SDKs

No changes between base commit (fdef826) and head commit (21b4777).

Test Logs

@sam-gc sam-gc force-pushed the samgho/auth-object branch from 9d9552e to 519374a Compare April 20, 2020 17:13
@sam-gc sam-gc marked this pull request as ready for review April 20, 2020 17:15
@sam-gc sam-gc requested a review from bojeil-google April 20, 2020 17:15

// 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
Copy link
Contributor

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?

Copy link
Contributor Author

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)

Copy link
Contributor

@avolkovi avolkovi left a 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';
Copy link
Member

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.

Copy link
Contributor Author

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 {
Copy link
Member

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 ?

Copy link
Contributor Author

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)

@sam-gc sam-gc force-pushed the samgho/auth-object branch from da779cf to 1af71dd Compare April 21, 2020 18:00
@sam-gc sam-gc merged commit 7d821e4 into auth-next Apr 22, 2020
@avolkovi avolkovi deleted the samgho/auth-object branch April 22, 2020 19:13
@avolkovi avolkovi removed their assignment May 15, 2020
@firebase firebase locked and limited conversation to collaborators May 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants