Include tips for testing with enzyme in README#118
Include tips for testing with enzyme in README#118janicduplessis merged 4 commits intoAppAndFlow:masterfrom mlodato517:include-mock-example-in-readme
Conversation
Specifically the insight from #31 (comment).
README.md
Outdated
| <ComponentUnderTest /> | ||
| </SafeAreaProvider> | ||
| ) | ||
| ``` |
There was a problem hiding this comment.
Not sure if it's worth linking to the appropriate issues/comments in here?
There was a problem hiding this comment.
initialSafeAreaInsets is the old API. Aren't you trying to do the same thing as the previous example under testing? What the previous example seems to miss is to render a component inside the provider which you have added here. Can you update the other example to include that instead?
There was a problem hiding this comment.
Can you update the other example to include that
Absolutely! I was wondering what was going on in that example because it didn't make obvious sense to render SafeAreaProvider with nothing under it but it seems like it was maybe just an incomplete example?
initialSafeAreaInsetsis the old API.
Ah, didn't know that. Should I include it in the "Deprecated apis" section so it's more visible?
There was a problem hiding this comment.
Yeah I think it's just incomplete example. cc @janicduplessis
There was a problem hiding this comment.
The deprecated api is actually initialWindowSafeAreaInsets, and is already included in the doc so I just removed it. Rest looks good, thanks!
Summary
I was hoping to update the README to include the insight from this comment. My coworkers and I spent some time trying to figure out how to properly render a component under a
SafeAreaProviderusingenzyme. One engineer found this comment which is copied by the above comment. I figure if there are several people independently looking for answers to this across packages it may be worth calling it out in the documentation.But of course, it may not be worth including documentation for a potential edge case bound to a specific testing utility! And I do realize that this comment mentions fixing this more holistically so I'm totally okay with just closing this PR but I didn't know if this would help users discover solutions faster in the interim?