Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add requirement for component tests #18015

Merged
merged 3 commits into from
Nov 29, 2023
Merged

Add requirement for component tests #18015

merged 3 commits into from
Nov 29, 2023

Conversation

vkjr
Copy link
Contributor

@vkjr vkjr commented Nov 28, 2023

Summary

Added requirement to have a component test without props. To ensure components don't crash in such case

status: ready

@vkjr vkjr self-assigned this Nov 28, 2023
@J-Son89
Copy link
Contributor

J-Son89 commented Nov 28, 2023

perhaps this is just something we can automate with schemas?
cc @clauxx/ @ilmotta
e.g have a test that checks the schemas and generates the empty case for these components and ensure something renders? 🤔

@status-im-auto
Copy link
Member

status-im-auto commented Nov 28, 2023

Jenkins Builds

Click to see older builds (4)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ ce279e2 #1 2023-11-28 15:00:28 ~12 min android-e2e 🤖apk 📲
✔️ ce279e2 #1 2023-11-28 15:00:35 ~12 min tests 📄log
✔️ ce279e2 #1 2023-11-28 15:00:38 ~12 min android 🤖apk 📲
✔️ ce279e2 #1 2023-11-28 15:01:14 ~12 min ios 📱ipa 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 9118173 #3 2023-11-29 18:03:39 ~6 min android 🤖apk 📲
✔️ 9118173 #3 2023-11-29 18:04:28 ~6 min ios 📱ipa 📲
✔️ 9118173 #3 2023-11-29 18:08:53 ~11 min android-e2e 🤖apk 📲
✔️ 42409a0 #4 2023-11-29 18:21:18 ~8 min android-e2e 🤖apk 📲
✔️ 42409a0 #4 2023-11-29 18:22:33 ~9 min android 🤖apk 📲
✔️ 42409a0 #4 2023-11-29 18:23:58 ~11 min tests 📄log
✔️ 42409a0 #4 2023-11-29 18:24:54 ~11 min ios 📱ipa 📲

@ilmotta
Copy link
Contributor

ilmotta commented Nov 28, 2023

perhaps this is just something we can automate with schemas? cc @clauxx/ @ilmotta e.g have a test that checks the schemas and generates the empty case for these components and ensure something renders? 🤔

Once a components has a function schema, what we consider "empty" will need to fulfill the schema. The minimum set of args may be an empty map, but it may not be as well. Automating this is tricky, unless it's the obvious empty map case (but then we don't need malli for that).

The other technique is with generative tests, which often are able to shrink the valid set of args to a minimum, so they often find the empty cases (empty strings, nil values, empty maps, and so on). Sadly, component tests are considerably slower than normal unit tests, so I think generative tests in component tests need further experimentation.

All this to say, I'm not sure how much malli can help us reinforce or automate the generation of default test cases because malli doesn't know how to magically shrink to the default case. It's worth exploring @J-Son89.

@J-Son89
Copy link
Contributor

J-Son89 commented Nov 28, 2023

Okay, let's add to the guidelines for now and we can do some experimentation with it and come back to this later on.

@J-Son89
Copy link
Contributor

J-Son89 commented Nov 29, 2023

btw, @ilmotta raised a good point before. For docs changes we should add many reviewers and share in the channel for everyone to see. More likely that everyone becomes aware of the updates then 👌

@@ -687,6 +687,17 @@ actually subscribing to them, so reframe's signal graph gets validated too.
(is (= expected (rf/sub [sub-name])))))
```

#### Component tests
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps a better location for this is in the quo directory - there is a readMe there?
https://github.com/status-im/status-mobile/blob/develop/src/quo/README.md

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@J-Son89, not sure about this. I think that document tree in the main readme file is more convenient, because it is likely to be read. The chance that people will find this piece of information in some other directory is much lower. For example I didn't even know that quo directory has a readme... just never noticed

Copy link
Contributor

Choose a reason for hiding this comment

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

To me both places seem okay to have this information,
I'd lean more towards Quo readme because this guideline specifically is related to quo component tests and would be good to maybe have that linked somehow here in guidelines document.
No strong opinions however :)

Copy link
Contributor

Choose a reason for hiding this comment

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

I think dispersing the READMEs in top-level directories is a common practice, but easy to overlook. Good point @vkjr, maybe we should also have a top-level table of contents on the main guidelines file pointing to secondary READMEs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved the text about no-props test to quo/readme, added link to that readme in guidelines, under "project structure" section, wdyt?

@vkjr
Copy link
Contributor Author

vkjr commented Nov 29, 2023

btw, @ilmotta raised a good point before. For docs changes we should add many reviewers and share in the channel for everyone to see. More likely that everyone becomes aware of the updates then 👌

@J-Son89, fully agree, will post it in discord

Copy link
Contributor

@siddarthkay siddarthkay left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@mohsen-ghafouri mohsen-ghafouri left a comment

Choose a reason for hiding this comment

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

👍🏻

Copy link
Member

@briansztamfater briansztamfater left a comment

Choose a reason for hiding this comment

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

LGTM!

@vkjr vkjr merged commit bfa23c1 into develop Nov 29, 2023
6 checks passed
@vkjr vkjr deleted the guidelines-component-tests branch November 29, 2023 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants