Add generated tests for ProgressBar and SearchResultSkeletonItem#369
Add generated tests for ProgressBar and SearchResultSkeletonItem#369coding-creed-technologies wants to merge 1 commit intoarabold:mainfrom
Conversation
…rchResultSkeletonItem Add unit tests for `ProgressBar` and `SearchResultSkeletonItem` components. - `ProgressBar` tests cover combinations of `progress` values and `showText` props. - `SearchResultSkeletonItem` tests verify that three skeleton bars are rendered. - Helper assertions (`expectProgress`, `expectNoProgress`, `expectDiscovering`, `expectedDetermined`, `expectedIndetermined`) were added to validate HTML output. All tests were generated with 3TG and are deterministic. No functional changes were introduced.
|
While I appreciate adding more test cases, this seems like a very odd contribution. Two random UI components without any additional context? Thanks, I guess 🤷 😉 |
|
Thanks for the feedback, @arabold 🙂 We intentionally started with just two components because we didn’t want to open a huge PR without knowing if this testing approach is actually useful for your project. The tests were generated using a tool we’re building called 3TG, which generates tests from behavior scenarios defined in Markdown tables (hence the src/web/components/ProgressBar.3tg.md file). The idea is that instead of focusing mainly on test names, the behavior is defined first (inputs, props, expected behavior), and the tests are generated from those scenarios. So the tests become the executable version of the documented behavior. Our goal with this PR was mainly to see whether this style of tests is readable and useful from your perspective as maintainers, before adding more tests. If this approach looks interesting to you, we’d be happy to show you how we generated these tests and help you use 3TG on your project. We currently have a free plan and we can increase the generation quota for early users who try it and share their experience publicly, since we’re still in the early stages and looking for feedback from real projects. In any case, feedback from you on whether these tests are helpful or not would be very valuable for us. |
Summary
This PR adds 3TG-generated unit tests for web components in the repository:
ProgressBar.tsxSearchResultSkeletonItem.tsxThe tests systematically cover variations of input props, HTML rendering, and expected behavior.
For
ProgressBar, tests include:pages,totalPages,totalDiscoveredshowTextvalues (undefined,true,false)For
SearchResultSkeletonItem, tests verify that three skeleton bars are rendered.Test Isolation
Notes
Impact
Improves confidence in component rendering, behavior under multiple input scenarios, and future refactors.
Attribution
This contribution was generated with assistance from 3TG.
3TG is a behavior-first test generation tool for TypeScript functions and React components that creates clean, maintainable tests and improves developer productivity.