-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
Copy pathfunctions.spec.ts
39 lines (33 loc) · 1.32 KB
/
functions.spec.ts
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 { Functions, connectFunctionsEmulator, getFunctions, provideFunctions } from '@angular/fire/functions';
import { COMMON_CONFIG, functionsEmulatorPort } from '../test-config';
import { rando } from '../utils';
describe('Functions', () => {
let app: FirebaseApp;
let functions: Functions;
let providedFunctions: Functions;
let appName: string;
describe('single injection', () => {
beforeEach(() => {
appName = rando();
TestBed.configureTestingModule({
providers: [
provideFirebaseApp(() => initializeApp(COMMON_CONFIG, appName)),
provideFunctions(() => {
providedFunctions = getFunctions(getApp(appName));
connectFunctionsEmulator(providedFunctions, 'localhost', functionsEmulatorPort);
return providedFunctions;
}),
],
});
app = TestBed.inject(FirebaseApp);
functions = TestBed.inject(Functions);
});
it('should be injectable', () => {
expect(providedFunctions).toBeTruthy();
expect(functions).toEqual(providedFunctions);
expect(functions.app).toEqual(app);
});
});
});