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-2964 - Disable open loan actions for virtual patron #2588

Merged
merged 4 commits into from
Nov 20, 2023

Conversation

Terala-Priyanka
Copy link
Contributor

@Terala-Priyanka Terala-Priyanka commented Nov 13, 2023

Purpose

UIU-2964 - [DCB] Loan details: Disable loan actions (Lending library)

Approach

TODOS and Open Questions

Screencast

image

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.

@Terala-Priyanka Terala-Priyanka marked this pull request as draft November 13, 2023 09:10
@Terala-Priyanka Terala-Priyanka marked this pull request as ready for review November 15, 2023 12:51
@Terala-Priyanka Terala-Priyanka requested review from a team and gurleenkaurbp November 15, 2023 12:51
return 'Lost and paid';
describe('LoanDetails', () => {
describe('Render LoanProxyDetails component', () => {
it('When props ID and proxy ID are same with Loan Missing', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

There are a lot of tests that existed before this PR that don't follow the describe/it structure. These it statements don't tell what the expected behavior is.
I understand that it's out of scope of the ticket to refactor tests completely, so could you just fix the structure a bit? Wrap it statements in describe. describe should have the pre-conditions explained and it should have the expected behaviour?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see there are many tests that are not properly structured.
I think it will be good to address them in separate ticket, in order to keep the purpose of this PR in the scope of the ticket. Is that fine with you?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, please create a ticket then and it can be worked on separately

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
Created a ticket for the same - https://issues.folio.org/browse/UIU-3001
Please review and adjust any details in you wish to. Thank you

src/constants.js Outdated
@@ -348,3 +348,7 @@ export const USER_TYPES = {
SYSTEM: 'system',
DCB: 'dcb',
};

export const DCB_USER = {
lastName: 'DcbSystem'
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use this function to identify DCB users, instead of a hard-coded last name?
https://github.com/folio-org/ui-users/blob/master/src/components/util/util.js#L205

If not, maybe by a constant id if one exists? I'm just thinking that it might be possible to create multiple users with this last name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you! I have refined the logic accordingly. Also, cleaned up the new files.

@Terala-Priyanka Terala-Priyanka requested review from BogdanDenis and a team November 15, 2023 15:41
loanIsMissing: false,
userEvent.click(getAllByText('ui-users.loans.declareLost')[0]);
userEvent.click(getAllByText('ui-users.loans.declareLost')[1]);
userEvent.click(screen.queryAllByRole('button')[0]);
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it's better to use one approach to be consistent here - either use screen.someQuery or distract all queries from your render component method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mariia-aloshyna
It is an existing code. It can be addressed in the scope of https://issues.folio.org/browse/UIU-3001
I have added a reference to your comment in the ticket description.

Copy link

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

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@Terala-Priyanka Terala-Priyanka merged commit 705b58e into master Nov 20, 2023
4 checks passed
@Terala-Priyanka Terala-Priyanka deleted the UIU-2964 branch November 20, 2023 07:31
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.

4 participants