-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathmessaging.spec.ts
More file actions
75 lines (58 loc) · 1.88 KB
/
messaging.spec.ts
File metadata and controls
75 lines (58 loc) · 1.88 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
import { TestBed } from '@angular/core/testing';
import { AngularFireModule, FIREBASE_APP_NAME, FIREBASE_OPTIONS, FirebaseApp } from '@angular/fire';
import { AngularFireMessaging, AngularFireMessagingModule } from './public_api';
import { COMMON_CONFIG } from '../test-config';
import { rando } from '../firestore/utils.spec';
describe('AngularFireMessaging', () => {
let app: FirebaseApp;
let afm: AngularFireMessaging;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
AngularFireModule.initializeApp(COMMON_CONFIG, rando()),
AngularFireMessagingModule
]
});
app = TestBed.inject(FirebaseApp);
afm = TestBed.inject(AngularFireMessaging);
});
afterEach(() => {
app.delete();
});
it('should be exist', () => {
expect(afm instanceof AngularFireMessaging).toBe(true);
});
it('should have the FCM instance', () => {
expect(afm.deleteToken).toBeDefined();
});
});
const FIREBASE_APP_NAME_TOO = (Math.random() + 1).toString(36).substring(7);
describe('AngularFireMessaging with different app', () => {
let app: FirebaseApp;
let afm: AngularFireMessaging;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
AngularFireModule.initializeApp(COMMON_CONFIG, rando()),
AngularFireMessagingModule
],
providers: [
{ provide: FIREBASE_APP_NAME, useValue: FIREBASE_APP_NAME_TOO },
{ provide: FIREBASE_OPTIONS, useValue: COMMON_CONFIG }
]
});
app = TestBed.inject(FirebaseApp);
afm = TestBed.inject(AngularFireMessaging);
});
afterEach(() => {
app.delete();
});
describe('<constructor>', () => {
it('should be an AngularFireMessaging type', () => {
expect(afm instanceof AngularFireMessaging).toEqual(true);
});
it('should have the FCM instance', () => {
expect(afm.deleteToken).toBeDefined();
});
});
});