extend-chrome / jest-chrome

A complete mock of the Chrome API for Chrome extensions for use with Jest.
MIT License
124 stars 24 forks source link

Add Event#getListeners #5

Closed jacksteamdev closed 4 years ago

jacksteamdev commented 4 years ago

This PR adds a method to get a shallow copy of the internal listeners Set. Changes to this Set will not modify the internal set, but if fine-grained assertions are required, or if you've done something crazy like wrapping the Chrome API Event objects, this feature will provide some relief.

Also, there was a runtime type check during calls to Event#callListeners, which was not tested and was sometimes wrong. This has been removed.