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

(test) Refactor tests for the Form component #207

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

denniskigen
Copy link
Member

@denniskigen denniskigen commented Apr 23, 2024

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

This PR refactors tests for the Form component with the primary goal of reducing reliance on async behaviour and the use of asynchronous matchers. Consequently, the test suite should be easier to read and reason about. In most cases, rendering the component, allowing some time for the asynchronous behaviour to occur, and then checking for the disappearance of the loading spinner should be enough to allow asynchronous operations to complete.

In the few cases where the delay is insufficient and more time is required for async operations to complete, I've queued up the render using:

await act(async () => {
  renderForm(null, obsGroupTestForm);
});

Screenshots

Related Issue

Other

Copy link

github-actions bot commented Apr 23, 2024

Size Change: +13 B (0%)

Total Size: 1.06 MB

ℹ️ View Unchanged
Filename Size Change
dist/100.js 2.41 kB 0 B
dist/225.js 2.57 kB 0 B
dist/29.js 169 kB 0 B
dist/327.js 1.58 kB 0 B
dist/353.js 3.02 kB 0 B
dist/402.js 237 kB +13 B (0%)
dist/459.js 6.07 kB 0 B
dist/505.js 6.95 kB 0 B
dist/540.js 2.63 kB 0 B
dist/606.js 2.23 kB 0 B
dist/616.js 202 kB 0 B
dist/791.js 9.8 kB 0 B
dist/859.js 830 B 0 B
dist/886.js 6.59 kB 0 B
dist/942.js 482 B 0 B
dist/981.js 85.7 kB 0 B
dist/993.js 3.08 kB 0 B
dist/main.js 311 kB 0 B
dist/openmrs-form-engine-lib.js 3.57 kB 0 B

compressed-size-action

@denniskigen denniskigen force-pushed the test/refactor-form-tests branch 3 times, most recently from 2691fc1 to 21afc8d Compare April 23, 2024 21:02
Copy link
Member

@samuelmale samuelmale left a comment

Choose a reason for hiding this comment

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

LGTM @denniskigen 🍺

@samuelmale samuelmale merged commit 0f42291 into main Apr 23, 2024
5 checks passed
@samuelmale samuelmale deleted the test/refactor-form-tests branch April 23, 2024 22:01
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