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

Added unit tests for WorkflowDetail component #326

Closed
wants to merge 1 commit into from

Conversation

saimedhi
Copy link
Collaborator

Description

Added unit tests for WorkflowDetail component

Issues Resolved

Related to #95

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Comment on lines +47 to +48
expect(baseElement.tagName).toBe('BODY');
expect(container.tagName).toBe('DIV');
Copy link
Member

Choose a reason for hiding this comment

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

This isn't a useful thing to test. We should test that certain wording exists, or other descriptors of components that we would be expecting when this renders. I would recommend looking at the AD OSD plugin unit tests for more examples. You can also refer to the testing-library documentation for more info and examples.

At a high-level, we use jest as the test framework, and @testing-library/react as a helper library for rendering and pulling out UI elements. A basic flow for testing UI components/pages is:

  1. Render the component using render() (optionally with different props for different states)
  2. Run testing-library queries (linked above) against that returned component to ensure certain elements exist etc.
  3. Assert that those queries return what is expected using jest, such as expect()

@saimedhi saimedhi closed this Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants