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

UIPFU-81 - Add jest tests to Filters.js #274

Merged
merged 16 commits into from
Sep 5, 2024
Merged

UIPFU-81 - Add jest tests to Filters.js #274

merged 16 commits into from
Sep 5, 2024

Conversation

Terala-Priyanka
Copy link
Contributor

@Terala-Priyanka Terala-Priyanka commented Aug 30, 2024

Purpose

UIPFU-81 - Add jest tests to Filters.js

Approach

We are migrating our unit tests to jest.
Currently, we have updated the pipelines to pick Jest tests.

Questions

is it possible to run both the framework tests - jest and bigtest ?

Pre-Merge Checklist

Before merging this PR, please go through the following list and take appropriate actions.

  • I've added appropriate record to the CHANGELOG.md
  • Does this PR meet or exceed the expected quality standards?
    • Code coverage on new code is 80% or greater
    • Duplications on new code is 3% or less
    • There are no major code smells or security issues
  • Does this introduce breaking changes?
    • If any API-related changes - okapi interfaces and permissions are reviewed/changed correspondingly
    • There are no breaking changes in this PR.

If there are breaking changes, please STOP and consider the following:

  • What other modules will these changes impact?
  • Do JIRAs exist to update the impacted modules?
    • If not, please create them
    • Do they contain the appropriate level of detail? Which endpoints/schemas changed, etc.
    • Do they have all they appropriate links to blocked/related issues?
  • Are the JIRAs under active development?
    • If not, contact the project's PO and make sure they're aware of the urgency.
  • Do PRs exist for these changes?
    • If so, have they been approved?

Ideally all of the PRs involved in breaking changes would be merged in the same day to avoid breaking the folio-testing environment. Communication is paramount if that is to be achieved, especially as the number of intermodule and inter-team dependencies increase.

While it's helpful for reviewers to help identify potential problems, ensuring that it's safe to merge is ultimately the responsibility of the PR assignee.

Copy link

github-actions bot commented Aug 30, 2024

Jest Unit Test Statistics

10 tests  +10   10 ✔️ +10   10s ⏱️ +10s
  2 suites +  2     0 💤 ±  0 
  1 files   +  1     0 ±  0 

Results for commit cfbeb0b. ± Comparison against base commit 0138142.

♻️ This comment has been updated with latest results.

This comment has been minimized.

Copy link

github-actions bot commented Aug 30, 2024

BigTest Unit Test Statistics

0 tests  ±0   0 ✔️ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ±0 

Results for commit cfbeb0b. ± Comparison against base commit 0138142.

♻️ This comment has been updated with latest results.

@Terala-Priyanka Terala-Priyanka marked this pull request as draft August 30, 2024 08:26
@Terala-Priyanka Terala-Priyanka self-assigned this Aug 30, 2024
@Terala-Priyanka Terala-Priyanka marked this pull request as ready for review September 4, 2024 06:48
});

it('should call changeHandler on clicking inactive checkbox', async () => {
const inActiveCheckbox = document.querySelector('[ id = "clickable-filter-active-inactive"]');

Choose a reason for hiding this comment

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

is it possible to find the checkbox using getByRole()?


let rtlApi;


Choose a reason for hiding this comment

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

remove an extra blank line, please

package.json Outdated
@@ -48,6 +48,7 @@
"eslint": "^7.32.0",
"eslint-import-resolver-webpack": "^0.13.2",
"faker": "^4.1.0",
"history": "^5.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @Terala-Priyanka, could you change the history to v4? react-router@5 doesn't support history@5 and it may cause test failures

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @BogdanDenis
Thank you for bringing this up.
I have noticed that history v5 is used with react-router@5 within ui-users.
It works seamlessly in the workflows too.

Could you please share if there is anything specific about this incompatibility?

Copy link
Contributor

Choose a reason for hiding this comment

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

@Terala-Priyanka we've had some test errors because history.listen was called with a slightly different location argument structure in tests versus in real application. It was a difficult issue to debug because I also assumed that history@5 is supposed to be used with react-router@5

@@ -0,0 +1,80 @@
import { screen } from '@folio/jest-config-stripes/testing-library/react';
Copy link
Contributor

Choose a reason for hiding this comment

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

Please re-order imports so that first we import third-party modules, then stripes modules, and last is imports from current module. Please also check other files in this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @BogdanDenis
Thank you for the insights. I have pushed the change. Could you please re-review it?

Copy link

sonarqubecloud bot commented Sep 5, 2024

@Terala-Priyanka Terala-Priyanka merged commit 615bbb5 into master Sep 5, 2024
6 checks passed
@Terala-Priyanka Terala-Priyanka deleted the UIPFU-81 branch September 5, 2024 08:52
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.

3 participants