File this under: seems obvious but I didn’t think about it till now.

let event = {
    keyCode: 9,
    preventDefault: jasmine.createSpy('preventDefault')

Some context: I’m currently dealing with Karma telling me that a function within an $event doesn’t have preventDefault() as a function. Okay. Well then…

In my head, the $event is just an object. Nothing special. Why would I possibly have a function in it?

Considering my usual use of Spies is to pass through or return some fake data from a service, it never crossed my mind that I’d use it like this.

For further context: this snippet sits just inside the describe() for the test and before any of the it()‘s for the test.