@@ -19,6 +19,16 @@ const { updateTemplate } = require('./helpers');
19
19
20
20
describe ( 'remoteConfig()' , function ( ) {
21
21
describe ( 'firebase v8 compatibility' , function ( ) {
22
+ beforeEach ( async function beforeEachTest ( ) {
23
+ // @ts -ignore
24
+ globalThis . RNFB_SILENCE_MODULAR_DEPRECATION_WARNINGS = true ;
25
+ } ) ;
26
+
27
+ afterEach ( async function afterEachTest ( ) {
28
+ // @ts -ignore
29
+ globalThis . RNFB_SILENCE_MODULAR_DEPRECATION_WARNINGS = false ;
30
+ } ) ;
31
+
22
32
describe ( 'fetch()' , function ( ) {
23
33
it ( 'with expiration provided' , async function ( ) {
24
34
const date = Date . now ( ) - 30000 ;
@@ -349,17 +359,19 @@ describe('remoteConfig()', function () {
349
359
describe ( 'modular' , function ( ) {
350
360
describe ( 'getRemoteConfig' , function ( ) {
351
361
it ( 'pass app as argument' , function ( ) {
362
+ const { getApp } = modular ;
352
363
const { getRemoteConfig } = remoteConfigModular ;
353
364
354
- const remoteConfig = getRemoteConfig ( firebase . app ( ) ) ;
365
+ const remoteConfig = getRemoteConfig ( getApp ( ) ) ;
355
366
356
367
remoteConfig . constructor . name . should . be . equal ( 'FirebaseConfigModule' ) ;
357
368
} ) ;
358
369
359
370
it ( 'no app as argument' , function ( ) {
371
+ const { getApp } = modular ;
360
372
const { getRemoteConfig } = remoteConfigModular ;
361
373
362
- const remoteConfig = getRemoteConfig ( firebase . app ( ) ) ;
374
+ const remoteConfig = getRemoteConfig ( getApp ( ) ) ;
363
375
364
376
remoteConfig . constructor . name . should . be . equal ( 'FirebaseConfigModule' ) ;
365
377
} ) ;
@@ -379,7 +391,7 @@ describe('remoteConfig()', function () {
379
391
380
392
await fetch ( remoteConfig , 0 ) ;
381
393
remoteConfig . lastFetchStatus . should . equal ( firebase . remoteConfig . LastFetchStatus . SUCCESS ) ;
382
- should . equal ( firebase . remoteConfig ( ) . fetchTimeMillis >= date , true ) ;
394
+ should . equal ( getRemoteConfig ( ) . fetchTimeMillis >= date , true ) ;
383
395
} ) ;
384
396
385
397
it ( 'without expiration provided' , function ( ) {
@@ -957,8 +969,9 @@ describe('remoteConfig()', function () {
957
969
958
970
describe ( 'setCustomSignals()' , function ( ) {
959
971
it ( 'should resolve with valid signal value; `string`, `number` or `null`' , async function ( ) {
972
+ const { getApp } = modular ;
960
973
const { setCustomSignals, getRemoteConfig } = remoteConfigModular ;
961
- const remoteConfig = getRemoteConfig ( firebase . app ( ) ) ;
974
+ const remoteConfig = getRemoteConfig ( getApp ( ) ) ;
962
975
// native SDKs just ignore invalid key/values (e.g. too long) and just log warning
963
976
const signals = {
964
977
string : 'string' ,
@@ -972,8 +985,9 @@ describe('remoteConfig()', function () {
972
985
} ) ;
973
986
974
987
it ( 'should reject with invalid signal value' , async function ( ) {
988
+ const { getApp } = modular ;
975
989
const { setCustomSignals, getRemoteConfig } = remoteConfigModular ;
976
- const remoteConfig = getRemoteConfig ( firebase . app ( ) ) ;
990
+ const remoteConfig = getRemoteConfig ( getApp ( ) ) ;
977
991
978
992
const invalidSignals = [
979
993
{ signal1 : true } ,
0 commit comments