Skip to content

Commit 5f830da

Browse files
committed
TestBed for database test, inject env for Auth and RC
1 parent 18b61e2 commit 5f830da

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

src/compat/auth/auth.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { isPlatformServer } from '@angular/common';
2-
import { Inject, Injectable, InjectionToken, NgZone, Optional, PLATFORM_ID } from '@angular/core';
2+
import { EnvironmentInjector, Inject, Injectable, InjectionToken, NgZone, Optional, PLATFORM_ID, inject } from '@angular/core';
33
import { pendingUntilEvent } from '@angular/core/rxjs-interop';
44
import { ɵAngularFireSchedulers } from '@angular/fire';
55
import { AppCheckInstances } from '@angular/fire/app-check';
@@ -55,6 +55,8 @@ export const ɵauthFactory = (
5555
})
5656
export class AngularFireAuth {
5757

58+
private readonly injector = inject(EnvironmentInjector);
59+
5860
/**
5961
* Observable of authentication state; as of Firebase 4.0 this is only triggered via sign-in/out
6062
*/
@@ -122,7 +124,7 @@ export class AngularFireAuth {
122124

123125
const redirectResult = auth.pipe(
124126
switchMap(auth => auth.getRedirectResult().then(it => it, () => null)),
125-
pendingUntilEvent(),
127+
pendingUntilEvent(this.injector),
126128
shareReplay({ bufferSize: 1, refCount: false }),
127129
);
128130

src/compat/database/database.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ describe('AngularFireDatabase', () => {
4242

4343
it('should accept a Firebase App in the constructor', (done) => {
4444
const schedulers = TestBed.runInInjectionContext(() => new ɵAngularFireSchedulers());
45-
const database = new AngularFireDatabase(
45+
const database = TestBed.runInInjectionContext(() => new AngularFireDatabase(
4646
app.options, rando(), undefined, {}, zone, schedulers, undefined, undefined,
4747
undefined, undefined, undefined, undefined, undefined, undefined, undefined,
48-
);
48+
));
4949
expect(database instanceof AngularFireDatabase).toEqual(true);
5050
// try { database.database.app.delete().then(done, done); } catch(e) { done(); }
5151
done();

src/compat/remote-config/remote-config.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Inject, Injectable, InjectionToken, NgZone, Optional, PLATFORM_ID } from '@angular/core';
1+
import { EnvironmentInjector, Inject, Injectable, InjectionToken, NgZone, Optional, PLATFORM_ID, inject } from '@angular/core';
22
import { pendingUntilEvent } from '@angular/core/rxjs-interop';
33
import { ɵAngularFireSchedulers } from '@angular/fire';
44
import { ɵPromiseProxy, ɵapplyMixins, ɵlazySDKProxy } from '@angular/fire/compat';
@@ -121,6 +121,8 @@ export class AngularFireRemoteConfig {
121121
readonly booleans: Observable<Record<string, boolean | undefined>> & Record<string, Observable<boolean>>;
122122
readonly strings: Observable<Record<string, string | undefined>> & Record<string, Observable<string | undefined>>;
123123

124+
private readonly injector = inject(EnvironmentInjector);
125+
124126
constructor(
125127
@Inject(FIREBASE_OPTIONS) options: FirebaseOptions,
126128
@Optional() @Inject(FIREBASE_APP_NAME) name: string | null | undefined,
@@ -186,7 +188,7 @@ export class AngularFireRemoteConfig {
186188

187189
this.parameters = concat(default$, existing$, fresh$).pipe(
188190
scanToParametersArray(remoteConfig$),
189-
pendingUntilEvent(),
191+
pendingUntilEvent(this.injector),
190192
shareReplay({ bufferSize: 1, refCount: true })
191193
);
192194

0 commit comments

Comments
 (0)