leapchat icon indicating copy to clipboard operation
leapchat copied to clipboard

Consider using enzyme for React testing

Open elimisteve opened this issue 7 years ago • 4 comments

https://github.com/airbnb/enzyme#basic-usage

@jimmcgaw Thoughts?

elimisteve avatar May 10 '17 21:05 elimisteve

Thanks for making the issue. Going beyond unit tests and testing the components themselves is definitely on my radar, and enzyme is the de facto choice for these kinds of tests. Much more lightweight than firing up an entire browser in selenium.

I was thinking of re-orging the components a bit (I'm not convinced the nesting still makes sense) and refactoring most of them to presentational ones before doing this.

jimmcgaw avatar May 11 '17 01:05 jimmcgaw

@jimmcgaw Which component nesting doesn't make sense, and what's the alternative(s)?

elimisteve avatar May 11 '17 07:05 elimisteve

I haven't dug into it. I remember glancing over MessageBox, MessageList, Message, ChatContainer, and so, and I feel like I just threw them together. The more I think about this, the more I think that adding tests will force me to make better component design decisions and rework accordingly. And refactoring is a better idea with existing test coverage.

jimmcgaw avatar May 11 '17 14:05 jimmcgaw

Tests; sounds good. I need to get into the habit of writing way more tests.

elimisteve avatar May 11 '17 14:05 elimisteve