Skip to content

Commit 118ba28

Browse files
committed
Fix test that verifies invoke error behaviour.
This test is supposed to verify that when the underlying method throws an error, `invoke` handles it gracefully and suppreses the error. However in this test the integration was never "ready". Under this condition, the integration bails on ready check before (` if (!this._ready) return this.queue(method, args);`), and never calls the underlying integration methods. This causes the error path to never be tested. The fix is to mark the integration as ready before calling invoke. This ensures that the broken `page` method we've setup for this test is invoked. This was only a test bug (i.e. the behaviour was still correct) and hence was likely not noticed until now. I discovered this when I was making the changes https://paper.dropbox.com/doc/Analytics.js-Metrics-SDD-1hAD90lqGS4aZxHAHYPu7#:h2=analytics.js-integration and didn't understand why my changes didn't break the existing tests. Note that I'll actually be removing the error suppression behaviour later as described in the SDD, but wanted to the fix the existing tests first before submitting my changes.
1 parent 39b439b commit 118ba28

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

test/index.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ describe('integration', function() {
293293
});
294294

295295
it('should catch errors when it calls', function() {
296+
integration.emit('ready');
296297
integration.initialize();
297298
integration.invoke('page', 'name');
298299
});

0 commit comments

Comments
 (0)