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

UIREQ-947 Create Jest/RTL test for RequestsRoute.js #1068

Merged
merged 7 commits into from
Jul 13, 2023
Merged

Conversation

VSnehalatha
Copy link
Contributor

Create Jest/RTL test for RequestsRoute.js
Refs: UIREQ-947

@github-actions
Copy link

github-actions bot commented Jun 23, 2023

Jest Unit Test Statistics

    1 files  ±  0    41 suites  ±0   1m 8s ⏱️ -1s
398 tests +22  398 ✔️ +22  0 💤 ±0  0 ±0 
399 runs  +22  399 ✔️ +22  0 💤 ±0  0 ±0 

Results for commit 5558707. ± Comparison against base commit c57ab7e.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Jun 23, 2023

BigTest Unit Test Statistics

132 tests  ±0   132 ✔️ ±0   17s ⏱️ -1s
    1 suites ±0       0 💤 ±0 
    1 files   ±0       0 ±0 

Results for commit 5558707. ± Comparison against base commit c57ab7e.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@artem-blazhko artem-blazhko left a comment

Choose a reason for hiding this comment

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

@Dmitriy-Litvinenko could you review it?

Comment on lines 99 to 122
const resultsFormatterHandler = () => {
resultsFormatter.itemBarcode(resultFormatterData);
resultsFormatter.position(resultFormatterData);
resultsFormatter.proxy(resultFormatterData);
resultsFormatter.requestDate(resultFormatterData);
resultsFormatter.requester(resultFormatterData);
resultsFormatter.requesterBarcode(resultFormatterData);
resultsFormatter.requestStatus(resultFormatterData);
resultsFormatter.type(resultFormatterData);
resultsFormatter.title(resultFormatterData);
resultsFormatter.year(resultFormatterData);
resultsFormatter.callNumber(resultFormatterData);
resultsFormatter.servicePoint(resultFormatterData);
};
const onClickActions = () => {
onDuplicate(records[0]);
buildRecordsForHoldsShelfReport();
getHelperResourcePath();
massageNewRecord({});
resultsFormatterHandler();
renderFilters(RequestFilterData.onChange);
resultIsSelected({ item: { id: 'id' } });
viewRecordOnCollapse();
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you clarify why you need it?
Using this approach you do not test existing functionality instead of that you trigger a lot of methods that help to increase code coverage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resultIsSelected({ item: { id: 'id' } });
viewRecordOnCollapse();
massageNewRecord({});

above 3 methods are used to update the state of object in the code.

jest.mock('react', () => ({
...jest.requireActual('react'),
createRef: jest.fn(),
}));

used above mock to clear console errors

@sonarcloud
Copy link

sonarcloud bot commented Jul 13, 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

No Coverage information No Coverage information
0.0% 0.0% Duplication

@artem-blazhko artem-blazhko merged commit 4459029 into master Jul 13, 2023
5 checks passed
@artem-blazhko artem-blazhko deleted the UIREQ-947 branch July 13, 2023 10:16
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