Is there any doc to write test for React component wrapping web components #453
-
Is there any doc to write test for React component wrapping web components |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @ajasingh! 🙂 I don't know of any guide for this. I worked in a project that was a library of web components and many of the consumers used React. We generated the wrappers for React by using the TS compiler to analyze the web component source code, but I guess it would be possible to just use Regexp for it as well. The unit tests tested the web components directly and we only had a small integration test to verify that the React wrappers worked. Another approach if done manually could be to test web components and React separately as the React component and web component can be considered as separate "units". |
Beta Was this translation helpful? Give feedback.
Hi @ajasingh! 🙂
I don't know of any guide for this.
I worked in a project that was a library of web components and many of the consumers used React. We generated the wrappers for React by using the TS compiler to analyze the web component source code, but I guess it would be possible to just use Regexp for it as well. The unit tests tested the web components directly and we only had a small integration test to verify that the React wrappers worked.
Another approach if done manually could be to test web components and React separately as the React component and web component can be considered as separate "units".