Skip to content

Instantly share code, notes, and snippets.

@gauntface
Created March 6, 2017 22:24
Show Gist options
  • Select an option

  • Save gauntface/c539ded88c42d9acebcd4d23e9c0b573 to your computer and use it in GitHub Desktop.

Select an option

Save gauntface/c539ded88c42d9acebcd4d23e9c0b573 to your computer and use it in GitHub Desktop.
it('should register install, activate and fetch event listeners', function() {
const eventsListenedTo = [];
global.self = {
// Mock methods here
addEventListener: (eventName, cb) => {
eventsListenedTo.push(eventName);
},
};
const myServiceWorkerLib = new Lib();
myServiceWorkerLib.setUpEventListeners();
eventsListenedTo.should.deep.equal(['install', 'activate', 'fetch']);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment