Hey,
I have a component that triggers an event using $this->emit, what options do I have to test it?
Thanks
Curious why you closed this, I think Livewire needs an assertion for this kind of thing.
I just added it for you. It's called assertEmitted($event). You can optionally pass in parameters to assert against params, or a callback to assert against a closure of your own.
Hope this helps you!
I'll have it available in the next release, and have it documented shortly.
Ok, the assertion has been tagged in a release and the feature is documented here: https://laravel-livewire.com/docs/testing/
Thank you @calebporzio
Curious why you closed this, I think Livewire needs an assertion for this kind of thing.
I just added it for you. It's called
assertEmitted($event). You can optionally pass in parameters to assert against params, or a callback to assert against a closure of your own.Hope this helps you!
I'll have it available in the next release, and have it documented shortly.
I want to try and go over the code today and see if I can do a PR to address it after I noticed that it is not available. But you were faster than me.
Most helpful comment
I want to try and go over the code today and see if I can do a PR to address it after I noticed that it is not available. But you were faster than me.