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) Enhancements to tests in the login app #342

Merged
merged 2 commits into from
Mar 3, 2022
Merged

Conversation

denniskigen
Copy link
Member

@denniskigen denniskigen commented Mar 3, 2022

Requirements

  • This PR has a title that briefly describes the work done, including the ticket number if there is a ticket.

For changes to apps

If applicable

  • My work includes tests or is validated by existing tests.
  • I have updated the esm-framework mock to reflect any API changes I have made.

Summary

This PR makes the following enhancements to tests in the login app:

  • Updates the Jest config modulenamemapper entry for @openmrs/esm-framework to point to the esm-framework mock bundled in @openmrs/esm-framework/mock instead of an outdated local mock. It also updates the lodash-es entry to map to lodash/$1 instead of locally maintained mocks.
  • Deletes a bunch of mocks that are no longer necessary.
  • Updates the default OpenMRS SVG logo with a title element. This makes it easier to target it in tests.
  • Updates specs to rectify some common mistakes with Testing Library. More specifically, this includes:
    • Using screen instead of wrapper querying wherever possible.
    • Replacing deprecated wait references with waitFor.
    • Removing cleanup references.
    • Using syntactic sugar like mockResolvedValue and mockReturnValue instead of their longer-form equivalents wherever possible.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2022

File size impact

Merging login-tests into master impact files as follow:

@openmrs/esm-devtools-app (no impact)
Files new size
Unmodified (5) 428 kB (0 B / +0%) 👻
Total (5) 428 kB (0 B / +0%) 👻
@openmrs/esm-implementer-tools-app (no impact)
Files new size
Unmodified (17) 1.85 MB (0 B / +0%) 👻
Total (17) 1.85 MB (0 B / +0%) 👻
@openmrs/esm-login-app (+0%)
Files new size
packages/apps/esm-login-app/dist/309.js 95.4 kB (+47 B / +0.05%) ↗️
Unmodified (27) 1.91 MB (0 B / +0%) 👻
Total (28) 2.01 MB (+47 B / +0%) ↗️
@openmrs/esm-offline-tools-app (no impact)
Files new size
Unmodified (26) 2.77 MB (0 B / +0%) 👻
Total (26) 2.77 MB (0 B / +0%) 👻
@openmrs/esm-primary-navigation-app (no impact)
Files new size
Unmodified (18) 2.14 MB (0 B / +0%) 👻
Total (18) 2.14 MB (0 B / +0%) 👻
@openmrs/esm-app-shell (no impact)
Files new size
packages/shell/esm-app-shell/dist/service-worker.js 164 kB (0 B / +0%) 👻
Unmodified (3) 1.94 MB (0 B / +0%) 👻
Total (4) 2.11 MB (0 B / +0%) 👻
Generated by @jsenv/file-size-impact during Report bundle size#1929497802 on 1862e94

@@ -123,6 +123,7 @@ const Login: React.FC<LoginProps> = ({ history, location, isLoginEnabled }) => {
/>
) : (
<svg role="img" className={styles["logo"]}>
<title>OpenMRS svg</title>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<title>OpenMRS svg</title>
<title>OpenMRS logo</title>

@brandones
Copy link
Collaborator

Thanks Dennis!

@denniskigen denniskigen merged commit f3f444e into master Mar 3, 2022
@denniskigen denniskigen deleted the login-tests branch March 3, 2022 18:18
@ZacButko ZacButko mentioned this pull request May 3, 2022
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