are react TestUtils part of the kotlin react wrapp...
# react
c
are react TestUtils part of the kotlin react wrappers? is there an example for unit testing a react component in kotlin?
😞 1
🚫 1
t
are react TestUtils part of the kotlin react wrappers?
Work required
c
thats really suprising, with jetbrains using kotlin and react in internal projects. do you not write tests for your components?
e
I was looking for this exactly. So sad and surprising.
c
@epabst do you think enzyme is better than the normal react test support?
e
I don't know. I haven't used any of them. I found this article: https://codeburst.io/revisiting-react-testing-in-2019-ee72bb5346f4
I looked at a few of them, and enzyme seems to have the needed Typescript bindings that Dukat needs. I have got Enzyme converted and compiling. I plan to try it out and if it works ok, to add it to my http://github.com/epabst/kotlin-showcase (not as a library but available to copy to kotlin-wrappers or wherever).
c
it seems that testing-library/react also has typescript definitions: https://www.npmjs.com/package/@types/testing-library__react
e
I haven't looked into testing-library/react yet, but FWIW, here are functioning bindings for enzyme: https://github.com/epabst/kotlin-showcase/tree/5d5129e556c8b168b0a0b838eec694664af37902/src/jsTest/kotlin/enzyme
I tried to convert @testing-library/react but Dukat didn't handle it very well. It didn't fail, but the code is very degenerate. e.g.
Copy code
external var act: Any
and
Copy code
external var within: Any
This is due to https://github.com/Kotlin/dukat/issues/277
c
pretty cool that you got enzyme working!
is the enzyme mapping totally autogenerated or did you have to manually fix it?
e
I had to manually fix it. About 30 minutes worth.