emit()
function enables components to communicate with one another. While this communication is a good candidate for end to end test, we can also test this in isolation within component. To do this, we’ll use cy.spy()
function that will watch for the defined function call. Using this, we can confirm that our emitted event was actually invoked.