@@ -21,6 +21,14 @@ describe('storage() -> StorageReference', function () {
2121 describe ( 'firebase v8 compatibility' , function ( ) {
2222 before ( async function ( ) {
2323 await seed ( PATH ) ;
24+
25+ // @ts -ignore
26+ globalThis . RNFB_SILENCE_MODULAR_DEPRECATION_WARNINGS = true ;
27+ } ) ;
28+
29+ after ( async function afterEachTest ( ) {
30+ // @ts -ignore
31+ globalThis . RNFB_SILENCE_MODULAR_DEPRECATION_WARNINGS = false ;
2432 } ) ;
2533
2634 describe ( 'toString()' , function ( ) {
@@ -671,24 +679,24 @@ describe('storage() -> StorageReference', function () {
671679 } ) ;
672680 } ) ;
673681 } ) ;
674- } ) ;
675682
676- describe ( 'put secondaryApp' , function ( ) {
677- it ( 'allows valid metadata properties for upload' , async function ( ) {
678- const storageReference = firebase
679- . storage ( firebase . app ( 'secondaryFromNative' ) )
680- // .storage()
681- . ref ( `${ PATH } /metadataTest.jpeg` ) ;
682- await storageReference . put ( new ArrayBuffer ( ) , {
683- contentType : 'image/jpg' ,
684- md5hash : '123412341234' ,
685- cacheControl : 'true' ,
686- contentDisposition : 'disposed' ,
687- contentEncoding : 'application/octet-stream' ,
688- contentLanguage : 'de' ,
689- customMetadata : {
690- customMetadata1 : 'metadata1value' ,
691- } ,
683+ describe ( 'put secondaryApp' , function ( ) {
684+ it ( 'allows valid metadata properties for upload' , async function ( ) {
685+ const storageReference = firebase
686+ . storage ( firebase . app ( 'secondaryFromNative' ) )
687+ // .storage()
688+ . ref ( `${ PATH } /metadataTest.jpeg` ) ;
689+ await storageReference . put ( new ArrayBuffer ( ) , {
690+ contentType : 'image/jpg' ,
691+ md5hash : '123412341234' ,
692+ cacheControl : 'true' ,
693+ contentDisposition : 'disposed' ,
694+ contentEncoding : 'application/octet-stream' ,
695+ contentLanguage : 'de' ,
696+ customMetadata : {
697+ customMetadata1 : 'metadata1value' ,
698+ } ,
699+ } ) ;
692700 } ) ;
693701 } ) ;
694702 } ) ;
@@ -700,8 +708,9 @@ describe('storage() -> StorageReference', function () {
700708 before ( async function ( ) {
701709 await seed ( PATH ) ;
702710
711+ const { getApp } = modular ;
703712 const { getStorage } = storageModular ;
704- secondStorage = getStorage ( firebase . app ( ) , secondStorageBucket ) ;
713+ secondStorage = getStorage ( getApp ( ) , secondStorageBucket ) ;
705714 } ) ;
706715
707716 describe ( 'second storage bucket writes to Storage emulator' , function ( ) {
@@ -737,12 +746,12 @@ describe('storage() -> StorageReference', function () {
737746
738747 describe ( 'toString()' , function ( ) {
739748 it ( 'returns the correct bucket path to the file' , function ( ) {
749+ const { getApp } = modular ;
740750 const { getStorage, ref, toString } = storageModular ;
741751 const storageReference = ref ( getStorage ( ) , `/uploadNope.jpeg` ) ;
742- const app = firebase . app ( ) ;
743752
744753 toString ( storageReference ) . should . equal (
745- `gs://${ app . options . storageBucket } /uploadNope.jpeg` ,
754+ `gs://${ getApp ( ) . options . storageBucket } /uploadNope.jpeg` ,
746755 ) ;
747756 } ) ;
748757 } ) ;
@@ -768,10 +777,10 @@ describe('storage() -> StorageReference', function () {
768777
769778 describe ( 'bucket' , function ( ) {
770779 it ( 'returns the storage bucket as a string' , function ( ) {
780+ const { getApp } = modular ;
771781 const { getStorage, ref } = storageModular ;
772782 const storageReference = ref ( getStorage ( ) , '/foo/uploadNope.jpeg' ) ;
773- const app = firebase . app ( ) ;
774- storageReference . bucket . should . equal ( app . options . storageBucket ) ;
783+ storageReference . bucket . should . equal ( getApp ( ) . options . storageBucket ) ;
775784 } ) ;
776785 } ) ;
777786
@@ -879,14 +888,15 @@ describe('storage() -> StorageReference', function () {
879888
880889 describe ( 'getDownloadURL' , function ( ) {
881890 it ( 'should return a download url for a file' , async function ( ) {
891+ const { getApp } = modular ;
882892 const { getStorage, ref, getDownloadURL } = storageModular ;
883893 // This is frequently flaky in CI - but works sometimes. Skipping only in CI for now.
884894 if ( ! isCI ) {
885895 const storageReference = ref ( getStorage ( ) , `${ PATH } /list/file1.txt` ) ;
886896 const downloadUrl = await getDownloadURL ( storageReference ) ;
887897 downloadUrl . should . be . a . String ( ) ;
888898 downloadUrl . should . containEql ( 'file1.txt' ) ;
889- downloadUrl . should . containEql ( firebase . app ( ) . options . projectId ) ;
899+ downloadUrl . should . containEql ( getApp ( ) . options . projectId ) ;
890900 } else {
891901 this . skip ( ) ;
892902 }
@@ -931,6 +941,7 @@ describe('storage() -> StorageReference', function () {
931941
932942 describe ( 'getMetadata' , function ( ) {
933943 it ( 'should return a metadata for a file' , async function ( ) {
944+ const { getApp } = modular ;
934945 const { getStorage, ref, getMetadata } = storageModular ;
935946 const storageReference = ref ( getStorage ( ) , `${ PATH } /list/file1.txt` ) ;
936947 const metadata = await getMetadata ( storageReference ) ;
@@ -950,7 +961,7 @@ describe('storage() -> StorageReference', function () {
950961 metadata . contentEncoding . should . be . a . String ( ) ;
951962 metadata . contentDisposition . should . be . a . String ( ) ;
952963 metadata . contentType . should . equal ( 'text/plain' ) ;
953- metadata . bucket . should . equal ( `${ firebase . app ( ) . options . projectId } .appspot.com` ) ;
964+ metadata . bucket . should . equal ( `${ getApp ( ) . options . projectId } .appspot.com` ) ;
954965 metadata . metageneration . should . be . a . String ( ) ;
955966 metadata . md5Hash . should . be . a . String ( ) ;
956967 // TODO against cloud storage cacheControl comes back null/undefined by default. Emulator has a difference
@@ -1119,6 +1130,7 @@ describe('storage() -> StorageReference', function () {
11191130
11201131 describe ( 'updateMetadata' , function ( ) {
11211132 it ( 'should return the updated metadata for a file' , async function ( ) {
1133+ const { getApp } = modular ;
11221134 const { getStorage, ref, updateMetadata } = storageModular ;
11231135 const storageReference = ref ( getStorage ( ) , `${ PATH } /list/file1.txt` ) ;
11241136
@@ -1150,7 +1162,7 @@ describe('storage() -> StorageReference', function () {
11501162 metadata . timeCreated . should . be . a . String ( ) ;
11511163 metadata . metageneration . should . be . a . String ( ) ;
11521164 metadata . md5Hash . should . be . a . String ( ) ;
1153- metadata . bucket . should . equal ( `${ firebase . app ( ) . options . projectId } .appspot.com` ) ;
1165+ metadata . bucket . should . equal ( `${ getApp ( ) . options . projectId } .appspot.com` ) ;
11541166
11551167 // Things we just updated
11561168 metadata . cacheControl . should . equals ( 'cache-control' ) ;
@@ -1189,7 +1201,7 @@ describe('storage() -> StorageReference', function () {
11891201 metadata . timeCreated . should . be . a . String ( ) ;
11901202 metadata . metageneration . should . be . a . String ( ) ;
11911203 metadata . md5Hash . should . be . a . String ( ) ;
1192- metadata . bucket . should . equal ( `${ firebase . app ( ) . options . projectId } .appspot.com` ) ;
1204+ metadata . bucket . should . equal ( `${ getApp ( ) . options . projectId } .appspot.com` ) ;
11931205
11941206 // Things that we may set (or remove)
11951207 should . equal ( metadata . cacheControl , undefined ) ;
0 commit comments