Skip to content

Include tips for testing with enzyme in README#118

Merged
janicduplessis merged 4 commits intoAppAndFlow:masterfrom
mlodato517:include-mock-example-in-readme
Jul 23, 2020
Merged

Include tips for testing with enzyme in README#118
janicduplessis merged 4 commits intoAppAndFlow:masterfrom
mlodato517:include-mock-example-in-readme

Conversation

@mlodato517
Copy link
Copy Markdown
Contributor

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 SafeAreaProvider using enzyme. 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?

README.md Outdated
<ComponentUnderTest />
</SafeAreaProvider>
)
```
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it's worth linking to the appropriate issues/comments in here?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

@mlodato517 mlodato517 Jul 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

initialSafeAreaInsets is the old API.

Ah, didn't know that. Should I include it in the "Deprecated apis" section so it's more visible?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think it's just incomplete example. cc @janicduplessis

Copy link
Copy Markdown
Contributor Author

@mlodato517 mlodato517 Jul 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the meantime, I've updated the example in f79be73 and added initialSafeAreaInsets to the deprecated apis list in f6d4ee1 👍

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deprecated api is actually initialWindowSafeAreaInsets, and is already included in the doc so I just removed it. Rest looks good, thanks!

@janicduplessis janicduplessis merged commit b1824ef into AppAndFlow:master Jul 23, 2020
@mlodato517 mlodato517 deleted the include-mock-example-in-readme branch July 23, 2020 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants