Skip to content

Add generated tests for ProgressBar and SearchResultSkeletonItem#369

Open
coding-creed-technologies wants to merge 1 commit intoarabold:mainfrom
coding-creed-technologies:3tg-generated-tests
Open

Add generated tests for ProgressBar and SearchResultSkeletonItem#369
coding-creed-technologies wants to merge 1 commit intoarabold:mainfrom
coding-creed-technologies:3tg-generated-tests

Conversation

@coding-creed-technologies

Summary

This PR adds 3TG-generated unit tests for web components in the repository:

  • ProgressBar.tsx
  • SearchResultSkeletonItem.tsx

The tests systematically cover variations of input props, HTML rendering, and expected behavior.

For ProgressBar, tests include:

  • combinations of pages, totalPages, totalDiscovered
  • showText values (undefined, true, false)
  • verifying both determined and indetermined progress bars

For SearchResultSkeletonItem, tests verify that three skeleton bars are rendered.

Test Isolation

  • All tests run in isolation with Vitest.
  • HTML output is asserted using helper functions that verify expected progress, discovery state, and animation styles.
  • Tests are deterministic and do not rely on runtime state.

Notes

  • No component code was changed; this PR only adds tests.
  • The PR ensures proper coverage for edge cases and input combinations that may otherwise be missed.

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.

…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.
@arabold
Copy link
Owner

arabold commented Mar 20, 2026

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 🤷 😉

@coding-creed-technologies
Copy link
Author

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.

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.

2 participants