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

UIU-2943: ECS - Filter users by "User Type" #2555

Merged
merged 9 commits into from
Sep 19, 2023
Merged

UIU-2943: ECS - Filter users by "User Type" #2555

merged 9 commits into from
Sep 19, 2023

Conversation

alisher-epam
Copy link
Contributor

Purpose

UIU-2943

Approach

Screen.Recording.2023-09-13.at.12.41.59.AM.mov

TODOS and Open Questions

Learning

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.

@alisher-epam alisher-epam requested a review from a team September 12, 2023 20:44
@NikitaSedyx
Copy link
Contributor

@alisher-epam as we can filter users by type, do not forget to revert #2543

@alisher-epam
Copy link
Contributor Author

@NikitaSedyx I will modify the changes and revert them manually in my current PR.
Screenshot 2023-09-13 at 1 18 36 PM

@sonarcloud
Copy link

sonarcloud bot commented Sep 18, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

87.0% 87.0% Coverage
0.0% 0.0% Duplication

Copy link
Member

@zburke zburke left a comment

Choose a reason for hiding this comment

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

I got halfway through this but just gave up. Sorry. The PR description makes no attempt whatsoever to describe the purpose of this work, nor does it make any attempt to explain why the shadow-user details are being removed from the default query. The test descriptions do not match the test implementations. Additionally, the PR-template was left in place but not filled out.

I gave up somewhere in the UserSearchContainer tests.

Please clean this up and then re-request a review when you're actually ready for a review.

src/components/util/util.test.js Outdated Show resolved Hide resolved
src/components/util/util.test.js Outdated Show resolved Hide resolved
src/routes/UserSearchContainer.js Show resolved Hide resolved
import { screen } from '@folio/jest-config-stripes/testing-library/react';

import renderWithRouter from 'helpers/renderWithRouter';
import '../../../test/jest/__mock__/matchMedia.mock';
Copy link
Contributor

Choose a reason for hiding this comment

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

import '__mock__/matchMedia.mock'

Copy link
Member

@zburke zburke left a comment

Choose a reason for hiding this comment

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

This is a big improvement; thank you. It's much closer.

Some test descriptions still need some minor cleanup.

Please follow existing naming conventions and do not gratuitously change values.

Comment on lines +384 to +387
it('should return false', () => {
const data = isConsortiumEnabled();
expect(data).toBeFalsy();
});
Copy link
Member

Choose a reason for hiding this comment

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

Under what circumstances should it return false? This makes it sound like the function should always return false. Describe the situation you are actually testing. In this case, sth like "returns false (default) when given no data".

Comment on lines +389 to +392
it('should return true', () => {
const data = isConsortiumEnabled(STRIPES);
expect(data).toBe(true);
});
Copy link
Member

Choose a reason for hiding this comment

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

Under what circumstances should it return true? This makes it sound like it should always return true. Describe the situation you are testing, e.g. "returns true given a valid 'centralTenantId'". OOC, what happens/should happen when you pass a stripes object with different kinds of sparse data, e.g.

user.user.consortium === {}
user.user.consortium.centralTenantId === ''
user.user.consortium.centralTenantId === false
user.user.consortium.centralTenantId === null

Eh, never mind, this is somewhat covered in the tests below. The test descriptions could still be improved though.

import { isConsortiumEnabled } from '../../components/util';
import { USER_TYPES, statusFilter } from '../../constants';

const ACCORDION_ID_PREFIX = 'users_filter_accordion';
Copy link
Member

Choose a reason for hiding this comment

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

Constants, ❤️ . But please keep the same value that was there previously, with hyphens instead of underscores. I know this didn't break any tests, but who knows what else might rely on that value; if we can preserve it then we should.

src/views/UserSearch/Filters.js Outdated Show resolved Hide resolved
src/views/UserSearch/Filters.js Outdated Show resolved Hide resolved
src/views/UserSearch/Filters.js Outdated Show resolved Hide resolved
src/views/UserSearch/Filters.js Outdated Show resolved Hide resolved
src/views/UserSearch/Filters.js Outdated Show resolved Hide resolved
src/views/UserSearch/Filters.test.js Outdated Show resolved Hide resolved
@alisher-epam alisher-epam requested a review from zburke September 19, 2023 15:30
Copy link
Member

@zburke zburke left a comment

Choose a reason for hiding this comment

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

There was a lot of back-and-forth on this PR. Thanks for sticking with it and working to improve it.

LGTM!

@alisher-epam
Copy link
Contributor Author

@zburke Thank you for helping and caring not only about the code base but also improving our tech skills. You are a really good mentor. God bless you!

@alisher-epam alisher-epam merged commit b2d890a into master Sep 19, 2023
3 checks passed
@alisher-epam alisher-epam deleted the UIU-2943 branch September 19, 2023 17:55
alisher-epam added a commit that referenced this pull request Sep 20, 2023
* UIU-2943: ECS - Filter users by "User Type"

* tests: add tests

* update: revert UIU-2933 manually

* refactor: fix naming issues and minor improvements

* tests: fix test labeling issue

* tests: improve test cases
alisher-epam added a commit that referenced this pull request Oct 3, 2023
* UIU-2942: Assign/unassign a users affiliations adjustments

* UIU-2943: ECS - Filter users by "User Type" (#2555)

* UIU-2943: ECS - Filter users by "User Type"

* tests: add tests

* update: revert UIU-2933 manually

* refactor: fix naming issues and minor improvements

* tests: fix test labeling issue

* tests: improve test cases

* hide primary assigned affiliations

* hide primary and central affiliations

* tests: fix failing tests

* tests: fix failing tests

* display missing affiliations

* hide central and primary affiliations

* tests: fix failing tests

* tests: fix failing tests

* exclude primary affiliation

* fix: wrong comparison affiliation ids

* fix: not displaying affiliations

* test: fix sematic testing issues
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.

5 participants