0

I'm currently exploring unit testing and Vue test utils particularly. I have an external library (vue-toastification) that shows a toast message when something occurs. I'd like to test that this toast has been shown, if an Error was thrown. But the problem is that the toast is rendered outside component's scope (in App.vue, as far as I can see), meanwhile with .get method we can only retrieve child components of a wrapper. So, how can I access this toast component without mounting the whole application? Maybe I should somehow use <teleport>?

3
  • 2
    You preferably shouldn't. vue-toastification isn't your own unit and it adds moving parts, so it needs to be mocked Commented Mar 9, 2022 at 8:37
  • 1
    I agree with Estus. It's a third library that it's not your role to unit test. I think what you want to do (check that the notification appears) can be made with cypress Commented Mar 12, 2022 at 14:32
  • @EstusFlask and Adri HM, thank you guys, you were right, excuse my silly question:) Commented Mar 17, 2022 at 14:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.