-
Notifications
You must be signed in to change notification settings - Fork 938
Migrate Database to component framework #2327
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
ad67f84
to
661a662
Compare
@@ -38,13 +38,13 @@ describe('Crawler Support', function() { | |||
restRef = getFreshRepoFromReference(normalRef); | |||
forceRestClient(false); | |||
|
|||
tokenProvider = testAuthTokenProvider(restRef.database.app); | |||
// tokenProvider = testAuthTokenProvider(restRef.database.app); |
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 seems we are patching auth in app after app.database() has been called.
Under the component framework, authProvider is given as a parameter during database construction, so to mock auth, we should register the mock auth before app.database() is called. It also means we need a new app instance for each test, otherwise database and its authProvider is cached.
My question is how is the mocked auth used in tests. My intention is to ensure the tests with component framework cover all the use cases that are covered today.
I'm also confused because tests pass with these lines commented out.
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.
Hm. I don't understand the interactions here well enough to provide an adequate answer (I can do some research if required). If the tests pass against Prod and against the Emulator without mocking the auth token then I see little reason to do so.
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.
I double checked that all tests (browser, node, emulator) pass without mocking the auth token, so I removed these 2 lines and testAuthTokenProvider
.
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.
Based on the Firestore PR, this looks fine. I think there is one compile error we need to fix though.
@@ -38,13 +38,13 @@ describe('Crawler Support', function() { | |||
restRef = getFreshRepoFromReference(normalRef); | |||
forceRestClient(false); | |||
|
|||
tokenProvider = testAuthTokenProvider(restRef.database.app); | |||
// tokenProvider = testAuthTokenProvider(restRef.database.app); |
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.
Hm. I don't understand the interactions here well enough to provide an adequate answer (I can do some research if required). If the tests pass against Prod and against the Emulator without mocking the auth token then I see little reason to do so.
5557618
to
496ca88
Compare
* Migrate Database to component framework * revert auth formatting
* Migrate Database to component framework * revert auth formatting
* Migrate Database to component framework * revert auth formatting
* Migrate Database to component framework * revert auth formatting
* Component framework implementation (#2316) * Component implementation * update dep version * [AUTOMATED]: Prettier Code Styling * [AUTOMATED]: License Headers * rename variables * address comments * [AUTOMATED]: Prettier Code Styling * remove unused comment * update code * [AUTOMATED]: Prettier Code Styling * rename to clearInstance to have naming consistency * make FirebaseApp tests work again * fix node tests * [AUTOMATED]: Prettier Code Styling * add comments for ComponentType * [AUTOMATED]: Prettier Code Styling * pass Component directly into Providers * [AUTOMATED]: Prettier Code Styling * correct spellings * update readme * fix lint issue * remove unused import * fix API change * move types around * [AUTOMATED]: Prettier Code Styling * improve provider typing * [AUTOMATED]: Prettier Code Styling * Migrate analytics to component platform (#220) * migrate analytics * minor analytics refactoring * interface merge * [AUTOMATED]: Prettier Code Styling * [AUTOMATED]: License Headers * allow overwriting a registered component * [AUTOMATED]: Prettier Code Styling * change ComponentType to string enum * address comments * [AUTOMATED]: Prettier Code Styling * remove return only generics * Move identifier to options object for getImmediate() * [AUTOMATED]: Prettier Code Styling * Make getProvider() type safe * [AUTOMATED]: Prettier Code Styling * define a new method to replace overwrite flag * [AUTOMATED]: Prettier Code Styling * Make component type safe * [AUTOMATED]: Prettier Code Styling * remove the generic type from component container * Update FirebaseApp and Analytics * [AUTOMATED]: Prettier Code Styling * remove unneccessary casting * [AUTOMATED]: Prettier Code Styling * fix typo * address comments * [AUTOMATED]: Prettier Code Styling * update some types * [AUTOMATED]: Prettier Code Styling * handle errors from instance factory * [AUTOMATED]: Prettier Code Styling * Migrate Performance to component framework (#2325) * Migrate Performance to component framework * [AUTOMATED]: Prettier Code Styling * removed unused import * Migrate RC to component framework (#2324) * Migrate RC to component framework * [AUTOMATED]: Prettier Code Styling * remove unused import * Migrate storage to component framework (#2326) * Migrate Database to component framework (#2327) * Migrate Database to component framework * revert auth formatting * Mirgrate functions to component framework (#2328) * Migrate installations to component framework (#2322) * Migrate installations to component framework * remove unused import * update calling code according to the latest component changes * added forceRefresh back * Migrate messaging to component framework (#2323) * Migrate messaging to component framework * remove unused import * bundle firebase services in a single object * [AUTOMATED]: Prettier Code Styling * [AUTOMATED]: License Headers * address comment * Make tests work again * Migrate firestore to component framework (#2329) * Migrate Firestore to component framework * [AUTOMATED]: Prettier Code Styling * remove unused import * removed unnecessary type assertion * update getImmeidate call * Migrate testing to component framework * [AUTOMATED]: Prettier Code Styling * Update SDKs to use the new type system (#2358) * update database types * update Firestore types * update installations type * update messaging types * update functions types * update performance types * update remoteconfig types * update storage types * fix analytics issue * [AUTOMATED]: Prettier Code Styling * [AUTOMATED]: Prettier Code Styling * Use the new method * Migrate Auth to component framework (#2342) * Mirgrate Auth to component framework * update Auth types * [AUTOMATED]: Prettier Code Styling * address comments * update deps * [AUTOMATED]: Prettier Code Styling * Get installations service from the container (#2376) * Get installations from the container * [AUTOMATED]: Prettier Code Styling * revert dev changes * convert eslint from json to js. * [AUTOMATED]: Prettier Code Styling * fix broken scripts * address comments * [AUTOMATED]: Prettier Code Styling * fix typos
Context
go/firebase-js-platform
#2316 implements the proposal.
Changes
This PR changes
@firebase/database
to use the component platform implemented in #2316Dependencies
#2316
#2317