Skip to content

Commit c4d5dca

Browse files
committed
test(crashlytics): clean up crashlytics e2e modular tests
no functional change really, but now the crashlytics e2e tests are deprecation-warning "clean" while still exercising everything
1 parent 953320d commit c4d5dca

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

packages/crashlytics/e2e/crashlytics.e2e.js

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@
1717

1818
describe('crashlytics()', function () {
1919
describe('v8 compatibility', function () {
20+
beforeEach(async function beforeEachTest() {
21+
// @ts-ignore
22+
globalThis.RNFB_SILENCE_MODULAR_DEPRECATION_WARNINGS = true;
23+
});
24+
25+
afterEach(async function afterEachTest() {
26+
// @ts-ignore
27+
globalThis.RNFB_SILENCE_MODULAR_DEPRECATION_WARNINGS = false;
28+
});
29+
2030
describe('log()', function () {
2131
it('accepts any value', async function () {
2232
firebase.crashlytics().log('invertase');
@@ -251,7 +261,8 @@ describe('crashlytics()', function () {
251261
});
252262

253263
it('accepts string values', async function () {
254-
await firebase.crashlytics().setAttributes({ invertase: '1337' });
264+
const { getCrashlytics, setAttributes } = crashlyticsModular;
265+
await setAttributes(getCrashlytics(), { invertase: '1337' });
255266
});
256267
});
257268

@@ -263,13 +274,10 @@ describe('crashlytics()', function () {
263274
let logged = false;
264275
// eslint-disable-next-line no-console
265276
console.warn = msg => {
266-
// we console.warn for deprecated API, can be removed when we move to v9
267-
if (!msg.includes('method is deprecated')) {
268-
msg.should.containEql('expects an instance of Error');
269-
logged = true;
270-
// eslint-disable-next-line no-console
271-
console.warn = orig;
272-
}
277+
msg.should.containEql('expects an instance of Error');
278+
logged = true;
279+
// eslint-disable-next-line no-console
280+
console.warn = orig;
273281
};
274282

275283
recordError(getCrashlytics(), 1337);
@@ -344,19 +352,17 @@ describe('crashlytics()', function () {
344352

345353
describe('setCrashlyticsCollectionEnabled()', function () {
346354
it('false', async function () {
347-
const { getCrashlytics, setCrashlyticsCollectionEnabled, isCrashlyticsCollectionEnabled } =
348-
crashlyticsModular;
355+
const { getCrashlytics, setCrashlyticsCollectionEnabled } = crashlyticsModular;
349356
const crashlytics = getCrashlytics();
350357
await setCrashlyticsCollectionEnabled(crashlytics, false);
351-
should.equal(isCrashlyticsCollectionEnabled(crashlytics), false);
358+
should.equal(crashlytics.isCrashlyticsCollectionEnabled, false);
352359
});
353360

354361
it('true', async function () {
355-
const { getCrashlytics, setCrashlyticsCollectionEnabled, isCrashlyticsCollectionEnabled } =
356-
crashlyticsModular;
362+
const { getCrashlytics, setCrashlyticsCollectionEnabled } = crashlyticsModular;
357363
const crashlytics = getCrashlytics();
358364
await setCrashlyticsCollectionEnabled(crashlytics, true);
359-
should.equal(isCrashlyticsCollectionEnabled(crashlytics), true);
365+
should.equal(crashlytics.isCrashlyticsCollectionEnabled, true);
360366
});
361367

362368
it('errors if not boolean', async function () {

0 commit comments

Comments
 (0)