UncleGedd commented on issue #50:
URL: 
https://github.com/apache/incubator-flagon-useralejs/issues/50#issuecomment-814427806


   Also, you mentioned a `sendNavigator` unit test, will this suffice?
   
   ```js    
       it('sends logs on page exit with navigator', () => {
           const html = `<html><head></head><body></body></html>`;
           new JSDOM(html)
           const originalNavigator = global.navigator;
           let called = false;
           global.navigator = {
               sendBeacon: () => {
                   called = true;
               },
           };
   
           sendOnClose([{foo: 'bar'}], {on: true, url: 'test'});
           Object.defineProperty(global.document, 'visibilityState', {
               get: () => 'hidden'
           })
           global.document.dispatchEvent(new Event('visibilitychange'))
   
           global.navigator = originalNavigator
           expect(called).to.equal(true);
       });
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to