1
- import { Observable } from 'rxjs/Observable '
1
+ import { Observable } from 'rxjs'
2
2
import { forkJoin } from 'rxjs/observable/forkJoin' ;
3
+ import { map , mergeMap , tap } from 'rxjs/operators' ;
3
4
import { TestBed , inject } from '@angular/core/testing' ;
4
5
import { FirebaseApp , FirebaseAppConfig , AngularFireModule , FirebaseAppName } from 'angularfire2' ;
5
6
import { AngularFireStorageModule , AngularFireStorage , AngularFireUploadTask , StorageBucket } from 'angularfire2/storage' ;
@@ -90,12 +91,14 @@ describe('AngularFireStorage', () => {
90
91
const task = ref . put ( blob ) ;
91
92
// Wait for the upload
92
93
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
+ )
99
102
// finish the test
100
103
. subscribe ( done , done . fail ) ;
101
104
} ) ;
@@ -107,12 +110,14 @@ describe('AngularFireStorage', () => {
107
110
const task = ref . put ( blob , { customMetadata : { blah : 'blah' } } ) ;
108
111
// Wait for the upload
109
112
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
+ )
116
121
// finish the test
117
122
. subscribe ( done , done . fail ) ;
118
123
} ) ;
@@ -180,12 +185,14 @@ describe('AngularFireStorage w/options', () => {
180
185
const task = ref . put ( blob ) ;
181
186
// Wait for the upload
182
187
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
+ )
189
196
// finish the test
190
197
. subscribe ( done , done . fail ) ;
191
198
} ) ;
0 commit comments