Skip to content

Commit a07b83e

Browse files
committed
test(remote-config): fix all remoteConfig e2e modular deprecation warnings
1 parent f7435c2 commit a07b83e

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

packages/remote-config/e2e/config.e2e.js

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ const { updateTemplate } = require('./helpers');
1919

2020
describe('remoteConfig()', function () {
2121
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+
2232
describe('fetch()', function () {
2333
it('with expiration provided', async function () {
2434
const date = Date.now() - 30000;
@@ -349,17 +359,19 @@ describe('remoteConfig()', function () {
349359
describe('modular', function () {
350360
describe('getRemoteConfig', function () {
351361
it('pass app as argument', function () {
362+
const { getApp } = modular;
352363
const { getRemoteConfig } = remoteConfigModular;
353364

354-
const remoteConfig = getRemoteConfig(firebase.app());
365+
const remoteConfig = getRemoteConfig(getApp());
355366

356367
remoteConfig.constructor.name.should.be.equal('FirebaseConfigModule');
357368
});
358369

359370
it('no app as argument', function () {
371+
const { getApp } = modular;
360372
const { getRemoteConfig } = remoteConfigModular;
361373

362-
const remoteConfig = getRemoteConfig(firebase.app());
374+
const remoteConfig = getRemoteConfig(getApp());
363375

364376
remoteConfig.constructor.name.should.be.equal('FirebaseConfigModule');
365377
});
@@ -379,7 +391,7 @@ describe('remoteConfig()', function () {
379391

380392
await fetch(remoteConfig, 0);
381393
remoteConfig.lastFetchStatus.should.equal(firebase.remoteConfig.LastFetchStatus.SUCCESS);
382-
should.equal(firebase.remoteConfig().fetchTimeMillis >= date, true);
394+
should.equal(getRemoteConfig().fetchTimeMillis >= date, true);
383395
});
384396

385397
it('without expiration provided', function () {
@@ -957,8 +969,9 @@ describe('remoteConfig()', function () {
957969

958970
describe('setCustomSignals()', function () {
959971
it('should resolve with valid signal value; `string`, `number` or `null`', async function () {
972+
const { getApp } = modular;
960973
const { setCustomSignals, getRemoteConfig } = remoteConfigModular;
961-
const remoteConfig = getRemoteConfig(firebase.app());
974+
const remoteConfig = getRemoteConfig(getApp());
962975
// native SDKs just ignore invalid key/values (e.g. too long) and just log warning
963976
const signals = {
964977
string: 'string',
@@ -972,8 +985,9 @@ describe('remoteConfig()', function () {
972985
});
973986

974987
it('should reject with invalid signal value', async function () {
988+
const { getApp } = modular;
975989
const { setCustomSignals, getRemoteConfig } = remoteConfigModular;
976-
const remoteConfig = getRemoteConfig(firebase.app());
990+
const remoteConfig = getRemoteConfig(getApp());
977991

978992
const invalidSignals = [
979993
{ signal1: true },

0 commit comments

Comments
 (0)