feat: add tabs.onRemoved and tabs.onCreated mocks #180
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello 👋
I'm a core contributor to Adblock plus and i'm experimenting with using this library to help us write more unit tests.
I noticed that it misses a few methods on the tabs API that we would need to make use of, also noticed the issue #107 where somebody else encountered a similar problem.
I took a (very) quick stab at adding those missing methods:
tabs.onCreated
tabs.onRemoved
I followed the existing pattern that exists with
onUpdated
, i.e. I did not implement mock functionalities to make theaddListener
,removeListener
andhasListener
work (we could for an example keep track of the functions added as listeners and return correct values inhasListener
), but simply mocked them withjest.fn()
.Looking forward to feedback to on this 🤞