Testing createResource with dynamic import
I'm trying to test an
Icon
component that I built that uses a dynamic import inside of a createResource
. I attempted to mock createResource
but couldn't get it to work as expected... I'll just post a simplified version of the component in the hopes that someone knows based off of the code. And FWIW I'm using vite-plugin-solid-svg
to import svg files as solid components.
Also, I was prompted to try to do this because I can run tests to get 100% coverage on statements, branches, and lines... but my function coverage was like 3%. It seems to be related to the dynamic import so perhaps I'm barking up the wrong tree with createResource
?
1 Reply
I ended up solving this but decided to ultimately just ignore the dynamic import testing. If anyone is curious about the implementation I had to test 100% here is what I had: