Repository navigation
Expand file tree
/
Copy pathfunctions.spec.ts
More file actions
78 lines (62 loc) · 2.08 KB
/
Copy pathfunctions.spec.ts
File metadata and controls
78 lines (62 loc) · 2.08 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { TestBed } from '@angular/core/testing';
import { AngularFireModule, FIREBASE_APP_NAME, FIREBASE_OPTIONS, FirebaseApp } from '@angular/fire';
import { AngularFireFunctions, AngularFireFunctionsModule, ORIGIN, REGION } from './public_api';
import { COMMON_CONFIG } from '../test-config';
import 'firebase/functions';
import { rando } from '../firestore/utils.spec';
describe('AngularFireFunctions', () => {
let app: FirebaseApp;
let afFns: AngularFireFunctions;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
AngularFireModule.initializeApp(COMMON_CONFIG, rando()),
AngularFireFunctionsModule
]
});
app = TestBed.inject(FirebaseApp);
afFns = TestBed.inject(AngularFireFunctions);
});
afterEach(() => {
app.delete();
});
it('should exist', () => {
expect(afFns instanceof AngularFireFunctions).toBe(true);
});
it('should have the Firebase Functions instance', () => {
expect(afFns.useFunctionsEmulator).toBeDefined();
});
});
describe('AngularFireFunctions with different app', () => {
let app: FirebaseApp;
let afFns: AngularFireFunctions;
let firebaseAppName: string;
beforeEach(() => {
firebaseAppName = rando();
TestBed.configureTestingModule({
imports: [
AngularFireModule.initializeApp(COMMON_CONFIG, rando()),
AngularFireFunctionsModule
],
providers: [
{ provide: FIREBASE_APP_NAME, useValue: firebaseAppName },
{ provide: FIREBASE_OPTIONS, useValue: COMMON_CONFIG },
{ provide: ORIGIN, useValue: 'http://0.0.0.0:9999' },
{ provide: REGION, useValue: 'asia-northeast1' }
]
});
app = TestBed.inject(FirebaseApp);
afFns = TestBed.inject(AngularFireFunctions);
});
afterEach(() => {
app.delete();
});
describe('<constructor>', () => {
it('should be an AngularFireAuth type', () => {
expect(afFns instanceof AngularFireFunctions).toEqual(true);
});
it('should have the Firebase Functions instance', () => {
expect(afFns.useFunctionsEmulator).toBeDefined();
});
});
});