-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathauth.spec.ts
More file actions
39 lines (33 loc) · 1.23 KB
/
auth.spec.ts
File metadata and controls
39 lines (33 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { TestBed } from '@angular/core/testing';
import { FirebaseApp, getApp, initializeApp, provideFirebaseApp } from '@angular/fire/app';
import { Auth, connectAuthEmulator, getAuth, provideAuth } from '@angular/fire/auth';
import { COMMON_CONFIG, authEmulatorPort } from '../test-config';
import { rando } from '../utils';
describe('Auth', () => {
let app: FirebaseApp;
let auth: Auth;
let providedAuth: Auth;
let appName: string;
describe('single injection', () => {
beforeEach(() => {
appName = rando();
TestBed.configureTestingModule({
providers: [
provideFirebaseApp(() => initializeApp(COMMON_CONFIG, appName)),
provideAuth(() => {
providedAuth = getAuth(getApp(appName));
connectAuthEmulator(providedAuth, `http://localhost:${authEmulatorPort}`, { disableWarnings: true });
return providedAuth;
}),
],
});
app = TestBed.inject(FirebaseApp);
auth = TestBed.inject(Auth);
});
it('should be injectable', () => {
expect(providedAuth).toBeTruthy();
expect(auth).toEqual(providedAuth);
expect(auth.app).toEqual(app);
});
});
});