Skip to content

Commit

Permalink
[firebase-analytics] Fix failing test on setDebugModeEnabled
Browse files Browse the repository at this point in the history
  • Loading branch information
IjzerenHein committed Apr 14, 2020
1 parent b9c9d10 commit e6f9385
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 29 deletions.
27 changes: 19 additions & 8 deletions apps/test-suite/tests/FirebaseAnalytics.js
Expand Up @@ -6,6 +6,8 @@ export const name = 'FirebaseAnalytics';

export async function test({ describe, beforeAll, afterAll, it, xit, expect }) {
const isConfigured = !!FirebaseCore.DEFAULT_APP_OPTIONS;
const isWebConfigured = !!FirebaseCore.DEFAULT_WEB_APP_OPTIONS;
const isExpoClient = FirebaseCore.DEFAULT_APP_NAME !== '[DEFAULT]';
const itWhenConfigured = isConfigured ? it : xit;
const itWhenNotConfigured = isConfigured ? xit : it;

Expand Down Expand Up @@ -164,15 +166,24 @@ export async function test({ describe, beforeAll, afterAll, it, xit, expect }) {
});
});
describe('setDebugModeEnabled()', async () => {
itWhenNotConfigured(`fails when not configured`, async () => {
let error = null;
try {
await Analytics.setDebugModeEnabled(true);
} catch (e) {
error = e;
it(
isExpoClient && isWebConfigured
? `runs on client with web-config`
: `fails when not on client or without web-config`,
async () => {
let error = null;
try {
await Analytics.setDebugModeEnabled(true);
} catch (e) {
error = e;
}
if (isExpoClient && isWebConfigured) {
expect(error).toBeNull();
} else {
expect(error).not.toBeNull();
}
}
expect(error).not.toBeNull();
});
);
});
});
}
18 changes: 10 additions & 8 deletions packages/expo-firebase-analytics/build/ExpoFirebaseAnalytics.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e6f9385

Please sign in to comment.