SFC with <script setup> and testing #10205
Unanswered
einavk
asked this question in
Help/Questions
Replies: 1 comment 5 replies
-
By testing computeds etc you're testing internal implementation. You should test component's public API instead and that does not require exposing anything (unless you want to add public methods to the component's public API). |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi All,
I decided to get a hang of the new <script setup> way of writing in composition API, so I chose one of my project's components, and converted it (from options API).
When I was done, I went a head to fix the related jest tests of that component.
I then realized that in order to be able to test it fully, I need to expose just about anything using useExpose().
Moreover, I had to rewrite all the "computed" tests as they used the "call" and not the "mount" way of testing.
Thanks,
Einav
Beta Was this translation helpful? Give feedback.
All reactions