@@ -6,9 +6,7 @@ import { FirebaseApp, FirebaseAppConfig, AngularFireModule } from 'angularfire2'
66import { AngularFireStorageModule , AngularFireStorage } from 'angularfire2/storage' ;
77import { COMMON_CONFIG } from './test-config' ;
88
9- console . log ( AngularFireStorageModule ) ;
10-
11- fdescribe ( 'AngularFireStorage' , ( ) => {
9+ describe ( 'AngularFireStorage' , ( ) => {
1210 let app : firebase . app . App ;
1311 let afStorage : AngularFireStorage ;
1412
@@ -62,10 +60,32 @@ fdescribe('AngularFireStorage', () => {
6260 const blob = new Blob ( [ JSON . stringify ( data ) ] , { type : 'application/json' } ) ;
6361 const ref = afStorage . ref ( 'af.json' ) ;
6462 const task = ref . put ( blob ) ;
63+ // Wait for the upload
6564 const sub = forkJoin ( task . snapshotChanges ( ) )
65+ // get the url download
6666 . mergeMap ( ( ) => ref . getDownloadURL ( ) )
67+ // assert the URL
6768 . do ( url => expect ( url ) . toBeDefined ( ) )
69+ // Delete the file
6870 . mergeMap ( url => ref . delete ( ) )
71+ // finish the test
72+ . subscribe ( done , done . fail ) ;
73+ } ) ;
74+
75+ it ( 'should upload, get metadata, and delete' , ( done ) => {
76+ const data = { angular : "fire" } ;
77+ const blob = new Blob ( [ JSON . stringify ( data ) ] , { type : 'application/json' } ) ;
78+ const ref = afStorage . ref ( 'af.json' ) ;
79+ const task = ref . put ( blob , { customMetadata : { blah : 'blah' } } ) ;
80+ // Wait for the upload
81+ const sub = forkJoin ( task . snapshotChanges ( ) )
82+ // get the metadata download
83+ . mergeMap ( ( ) => ref . getMetadata ( ) )
84+ // assert the URL
85+ . do ( meta => expect ( meta . customMetadata ) . toEqual ( { blah : 'blah' } ) )
86+ // Delete the file
87+ . mergeMap ( meta => ref . delete ( ) )
88+ // finish the test
6989 . subscribe ( done , done . fail ) ;
7090 } ) ;
7191
0 commit comments