You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 26, 2024. It is now read-only.
Writing tests should be improved in our project. Previously, the tests are minimally written to ensure that other contributors don't break the current features and functionalities.
However, it is great that we can enhance them and improve test readability. @yujong-lee has investigated and shared insights on current work and we'd like to discuss them further.
1. There's no toHaveStyle property in JestMatchers<ReactTestInstance> warning. I think It's related to type. But I install @testing-library/jest-native, which includes type(as I know). I don't know how to solve this.
Relying on the additional package @testing-library/jest-native looks great. Indeed, using toHaveStyle instead of snapshot testing looks charmed.
2. Why createTestProps is needed? I found that (in this case) the test doesn't break without it. I don't know a lot about React Native. So if you give me some context or explanation, I'll be thankful.
When we handle big components like pages or screens, they use to have lots of embedded props which causes lots of copy and pasting when writing test code. It might not be needed when we are writing tests for dooboo-ui, however, the current style is delivered from the experience we had when testing page components in HackaTalk. Usually, more context providers are wrapped with those components and all page components shared the same global props. Therefore, we ended up writing testUtils and share among them.
3. Why createComponent is needed? I think calling createComponent and wrap with ThemeProvider has very little difference in code size but later is more clear and flexible as I did here.
Yes, you are right. However, as explained in the previous answer, we had experiences when those became huge. To summarize, we made our own createTestProps and createComponent functions not to write the same things again in each page component test file. We can remove them if contributors really don't think we will need them in dooboo-ui.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Writing tests should be improved in our project. Previously, the tests are minimally written to ensure that other contributors don't break the current features and functionalities.
However, it is great that we can enhance them and improve test readability. @yujong-lee has investigated and shared insights on current work and we'd like to discuss them further.
List of discussions in #53.
1. There's no
toHaveStyle
property inJestMatchers<ReactTestInstance>
warning. I think It's related to type. But I install@testing-library/jest-native
, which includes type(as I know). I don't know how to solve this.@testing-library/jest-native
looks great. Indeed, usingtoHaveStyle
instead of snapshot testing looks charmed.2. Why
createTestProps
is needed? I found that (in this case) the test doesn't break without it. I don't know a lot about React Native. So if you give me some context or explanation, I'll be thankful.dooboo-ui
, however, the current style is delivered from the experience we had when testing page components in HackaTalk. Usually, more context providers are wrapped with those components and all page components shared the same global props. Therefore, we ended up writing testUtils and share among them.3. Why
createComponent
is needed? I think callingcreateComponent
and wrap withThemeProvider
has very little difference in code size but later is more clear and flexible as I did here.createTestProps
andcreateComponent
functions not to write the same things again in each page component test file. We can remove them if contributors really don't think we will need them indooboo-ui
.Beta Was this translation helpful? Give feedback.
All reactions