Skip to content

Commit

Permalink
[tests][js][analytics] logEvent now validates argument types (fixes #846
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Salakar committed Mar 5, 2018
1 parent d1e86f5 commit e327174
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/src/tests/analytics/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,24 @@ export default function addTests({ describe, it, firebase }) {
resolve();
}));

it('logEvent should error if name is not a string', () => {
(() => {
firebase.native.analytics().logEvent(123456);
}).should.throw(
`analytics.logEvent(): First argument 'name' is required and must be a string value.`
);
});

it('logEvent should error if params is not an object', () => {
(() => {
firebase.native
.analytics()
.logEvent('test_event', 'this should be an object');
}).should.throw(
`analytics.logEvent(): Second optional argument 'params' must be an object if provided.`
);
});

it('setAnalyticsCollectionEnabled: it should run without error', () =>
new Promise(resolve => {
firebase.native.analytics().setAnalyticsCollectionEnabled(true);
Expand Down

0 comments on commit e327174

Please sign in to comment.