11import {
2- addProviders ,
2+ TestBed ,
33 inject
44} from '@angular/core/testing' ;
5- import { ReflectiveInjector , provide , Provider } from '@angular/core' ;
5+ import { ReflectiveInjector , Provider } from '@angular/core' ;
66import {
77 AngularFire ,
88 FirebaseObjectObservable ,
@@ -12,21 +12,16 @@ import {
1212 FirebaseApp ,
1313 defaultFirebase ,
1414 AngularFireDatabase ,
15- FirebaseAppConfig
15+ FirebaseAppConfig ,
16+ AngularFireModule
1617} from './angularfire2' ;
1718import { Subscription } from 'rxjs/Subscription' ;
19+ import { COMMON_CONFIG , ANON_AUTH_CONFIG } from './test-config' ;
1820import 'rxjs/add/operator/toPromise' ;
1921import 'rxjs/add/operator/take' ;
2022import 'rxjs/add/operator/do' ;
2123import 'rxjs/add/operator/delay' ;
2224
23- export const firebaseConfig : FirebaseAppConfig = {
24- apiKey : "AIzaSyBVSy3YpkVGiKXbbxeK0qBnu3-MNZ9UIjA" ,
25- authDomain : "angularfire2-test.firebaseapp.com" ,
26- databaseURL : "https://angularfire2-test.firebaseio.com" ,
27- storageBucket : "angularfire2-test.appspot.com" ,
28- } ;
29-
3025describe ( 'angularfire' , ( ) => {
3126 var subscription :Subscription ;
3227 var app : firebase . app . App ;
@@ -36,7 +31,11 @@ describe('angularfire', () => {
3631 var angularFire2 : AngularFire ;
3732
3833 beforeEach ( ( ) => {
39- addProviders ( [ FIREBASE_PROVIDERS , defaultFirebase ( firebaseConfig ) ] ) ;
34+
35+ TestBed . configureTestingModule ( {
36+ imports : [ AngularFireModule . initializeApp ( COMMON_CONFIG , ANON_AUTH_CONFIG ) ]
37+ } ) ;
38+
4039 inject ( [ FirebaseApp , AngularFire ] , ( firebaseApp : firebase . app . App , _af : AngularFire ) => {
4140 angularFire2 = _af ;
4241 app = firebaseApp ;
@@ -48,7 +47,7 @@ describe('angularfire', () => {
4847
4948 afterEach ( ( done ) => {
5049 rootRef . remove ( )
51- if ( subscription && ! subscription . isUnsubscribed ) {
50+ if ( subscription && ! subscription . closed ) {
5251 subscription . unsubscribe ( ) ;
5352 }
5453 app . delete ( ) . then ( done , done . fail ) ;
@@ -80,7 +79,7 @@ describe('angularfire', () => {
8079
8180 describe ( 'defaultFirebase' , ( ) => {
8281 it ( 'should create an array of providers' , ( ) => {
83- const providers = defaultFirebase ( firebaseConfig ) ;
82+ const providers = defaultFirebase ( COMMON_CONFIG ) ;
8483 expect ( providers . length ) . toBe ( 2 ) ;
8584 } ) ;
8685 } ) ;
0 commit comments