-
-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assertion that toast was called (with options?) #464
Comments
Hey. |
I've spent the last couple hours actually trying that, but I can't seem to figure out how to verify that if I call Example code: public function sendInvite(): void
{
...
toast()->success('Invite sent!')->push();
} This test still fails: test('a toast is pushed when invite is sent', function () {
assertFalse(ToastManager::componentRendered());
Livewire::test(Admin::class)
->set('emailAddress', '[email protected]')
->call('sendInvite');
assertTrue(ToastManager::componentRendered()); // <---- this line is what fails
}); I tried using the tests in this package as a guide to write my own but I can't even figure out the basic "does the component show", let alone is it a "success" type with the correct message. |
All what you can test for is that your message is sent and exists in the session(). Anything beyond that is actually tested in this library, so would be redundant. If you want to test that it is actually displayed on the front end, then you'd have to use a tool like Laravel Dusk, as the js part of this app cannot be tested without such tools. I'm open to PRs if anyone is willing to write such tests or expand on the existing ones. |
Description
Ok, so in my application, I'd like to be able to do something like
$this->assertToast(success, "Thanks for joining!");
to ensure that the toasts are actually being sent.Additional context
n/a
The text was updated successfully, but these errors were encountered: