1- import { Observable } from 'rxjs/Observable '
1+ import { Observable } from 'rxjs'
22import { forkJoin } from 'rxjs/observable/forkJoin' ;
3+ import { map , mergeMap , tap } from 'rxjs/operators' ;
34import { TestBed , inject } from '@angular/core/testing' ;
45import { FirebaseApp , FirebaseAppConfig , AngularFireModule , FirebaseAppName } from 'angularfire2' ;
56import { AngularFireStorageModule , AngularFireStorage , AngularFireUploadTask , StorageBucket } from 'angularfire2/storage' ;
@@ -90,12 +91,14 @@ describe('AngularFireStorage', () => {
9091 const task = ref . put ( blob ) ;
9192 // Wait for the upload
9293 const sub = forkJoin ( task . snapshotChanges ( ) )
93- // get the url download
94- . mergeMap ( ( ) => ref . getDownloadURL ( ) )
95- // assert the URL
96- . do ( url => expect ( url ) . toBeDefined ( ) )
97- // Delete the file
98- . mergeMap ( url => ref . delete ( ) )
94+ . pipe (
95+ // get the url download
96+ mergeMap ( ( ) => ref . getDownloadURL ( ) ) ,
97+ // assert the URL
98+ tap ( url => expect ( url ) . toBeDefined ( ) ) ,
99+ // Delete the file
100+ mergeMap ( url => ref . delete ( ) )
101+ )
99102 // finish the test
100103 . subscribe ( done , done . fail ) ;
101104 } ) ;
@@ -107,12 +110,14 @@ describe('AngularFireStorage', () => {
107110 const task = ref . put ( blob , { customMetadata : { blah : 'blah' } } ) ;
108111 // Wait for the upload
109112 const sub = forkJoin ( task . snapshotChanges ( ) )
110- // get the metadata download
111- . mergeMap ( ( ) => ref . getMetadata ( ) )
112- // assert the URL
113- . do ( meta => expect ( meta . customMetadata ) . toEqual ( { blah : 'blah' } ) )
114- // Delete the file
115- . mergeMap ( meta => ref . delete ( ) )
113+ . pipe (
114+ // get the metadata download
115+ mergeMap ( ( ) => ref . getMetadata ( ) ) ,
116+ // assert the URL
117+ tap ( meta => expect ( meta . customMetadata ) . toEqual ( { blah : 'blah' } ) ) ,
118+ // Delete the file
119+ mergeMap ( meta => ref . delete ( ) )
120+ )
116121 // finish the test
117122 . subscribe ( done , done . fail ) ;
118123 } ) ;
@@ -180,12 +185,14 @@ describe('AngularFireStorage w/options', () => {
180185 const task = ref . put ( blob ) ;
181186 // Wait for the upload
182187 const sub = forkJoin ( task . snapshotChanges ( ) )
183- // get the url download
184- . mergeMap ( ( ) => ref . getDownloadURL ( ) )
185- // assert the URL
186- . do ( url => expect ( url ) . toMatch ( new RegExp ( `https:\\/\\/firebasestorage\\.googleapis\\.com\\/v0\\/b\\/${ FIREBASE_STORAGE_BUCKET } \\/o\\/af\\.json` ) ) )
187- // Delete the file
188- . mergeMap ( url => ref . delete ( ) )
188+ . pipe (
189+ // get the url download
190+ mergeMap ( ( ) => ref . getDownloadURL ( ) ) ,
191+ // assert the URL
192+ tap ( url => expect ( url ) . toMatch ( new RegExp ( `https:\\/\\/firebasestorage\\.googleapis\\.com\\/v0\\/b\\/${ FIREBASE_STORAGE_BUCKET } \\/o\\/af\\.json` ) ) ) ,
193+ // Delete the file
194+ mergeMap ( url => ref . delete ( ) )
195+ )
189196 // finish the test
190197 . subscribe ( done , done . fail ) ;
191198 } ) ;
0 commit comments