| 
				
			 | 
			
			
				@@ -63,12 +63,12 @@ describe('firebase login', (report, done) => { 
			 | 
		
	
		
			
			| 
				63
			 | 
			
				63
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				64
			 | 
			
				64
			 | 
			
			
				 describe('upload file to firebase', (report, done) => { 
			 | 
		
	
		
			
			| 
				65
			 | 
			
				65
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				66
			 | 
			
				
			 | 
			
			
				-  // create Blob from BASE64 data 
			 | 
		
	
		
			
			| 
				67
			 | 
			
				
			 | 
			
			
				-  let blob = new Blob(RNTest.prop('image'), { type : 'image/png;BASE64'}) 
			 | 
		
	
		
			
			| 
				68
			 | 
			
				66
			 | 
			
			
				   let testImage = `firebase-test-${Platform.OS}-${Date.now()}.png` 
			 | 
		
	
		
			
			| 
				69
			 | 
			
				67
			 | 
			
			
				   RNTest.prop('firebase-image', testImage) 
			 | 
		
	
		
			
			| 
				70
			 | 
			
				
			 | 
			
			
				-  // start test after Blob created 
			 | 
		
	
		
			
			| 
				71
			 | 
			
				
			 | 
			
			
				-  blob.onCreated(() => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				68
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				69
			 | 
			
			
				+  // create Blob from BASE64 data 
			 | 
		
	
		
			
			| 
				
			 | 
			
				70
			 | 
			
			
				+  Blob.build(RNTest.prop('image'), { type : 'image/png;BASE64'}) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				71
			 | 
			
			
				+  .then((blob) => { 
			 | 
		
	
		
			
			| 
				72
			 | 
			
				72
			 | 
			
			
				     let storage = firebase.storage().ref('rnfbtest') 
			 | 
		
	
		
			
			| 
				73
			 | 
			
				73
			 | 
			
			
				     let task = storage 
			 | 
		
	
		
			
			| 
				74
			 | 
			
				74
			 | 
			
			
				       .child(RNTest.prop('firebase-image')) 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -147,3 +147,31 @@ describe('download to base64', (report, done) => { 
			 | 
		
	
		
			
			| 
				147
			 | 
			
				147
			 | 
			
			
				     done() 
			 | 
		
	
		
			
			| 
				148
			 | 
			
				148
			 | 
			
			
				   }) 
			 | 
		
	
		
			
			| 
				149
			 | 
			
				149
			 | 
			
			
				 }) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				150
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				151
			 | 
			
			
				+describe('upload from storage', (report, done) => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				152
			 | 
			
			
				+  try { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				153
			 | 
			
			
				+  let file = fs.dirs.DocumentDir + '/tempimg.png' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				154
			 | 
			
			
				+  fs.writeFile(file, RNTest.prop('image'), 'base64') 
			 | 
		
	
		
			
			| 
				
			 | 
			
				155
			 | 
			
			
				+    .then(() => Blob.build(RNFetchBlob.wrap(file), {type : 'image/png'})) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				156
			 | 
			
			
				+    .then((blob) => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				157
			 | 
			
			
				+      let storage = firebase.storage().ref('rnfbtest') 
			 | 
		
	
		
			
			| 
				
			 | 
			
				158
			 | 
			
			
				+      let task = storage 
			 | 
		
	
		
			
			| 
				
			 | 
			
				159
			 | 
			
			
				+        .child(`image-from-storage-${Platform.OS}-${Date.now()}.png`) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				160
			 | 
			
			
				+        .put(blob, { contentType : 'image/png' }) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				161
			 | 
			
			
				+        .then((snapshot) => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				162
			 | 
			
			
				+          console.log(snapshot.metadata) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				163
			 | 
			
			
				+          report(<Assert key="upload success" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				164
			 | 
			
			
				+            expect={true} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				165
			 | 
			
			
				+            actual={true}/>, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				166
			 | 
			
			
				+          <Info key="uploaded file stat" > 
			 | 
		
	
		
			
			| 
				
			 | 
			
				167
			 | 
			
			
				+            <Text>{snapshot.totalBytes}</Text> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				168
			 | 
			
			
				+            <Text>{JSON.stringify(snapshot.metadata)}</Text> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				169
			 | 
			
			
				+          </Info>) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				170
			 | 
			
			
				+          done() 
			 | 
		
	
		
			
			| 
				
			 | 
			
				171
			 | 
			
			
				+        }) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				172
			 | 
			
			
				+    }) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				173
			 | 
			
			
				+  } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				174
			 | 
			
			
				+  catch(err) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				175
			 | 
			
			
				+    console.log(err) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				176
			 | 
			
			
				+  } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				177
			 | 
			
			
				+}) 
			 |