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

feat: Improve code coverage 3 #1065

Merged
merged 13 commits into from
Apr 25, 2024
Merged

feat: Improve code coverage 3 #1065

merged 13 commits into from
Apr 25, 2024

Conversation

brobro10000
Copy link
Contributor

@brobro10000 brobro10000 commented Apr 18, 2024

Adds additional tests to improve coverage:
useBrowseAndRequest
useCourseRedemptionEligibility
useEnterpriseCourseEnrollments
useIsAssignmnetOnlyLearner
useLateRedemptionBuffer
usePassLearenrCsodParam

Updates hooks in course/data to more accurately test the intended behavior of the hooks.

Final iteration of improve code cov of the following PRs,
#1060
#1055

For all changes

  • Ensure adequate tests are in place (or reviewed existing tests cover changes)
  • Ensure English strings are marked for translation. See documentation for more details.

Only if submitting a visual change

  • Ensure to attach screenshots
  • Ensure to have UX team confirm screenshots

@@ -6,6 +6,36 @@ import { queryCanRedeem } from '../queries';
import useEnterpriseCustomer from './useEnterpriseCustomer';
import useLateRedemptionBufferDays from './useLateRedemptionBufferDays';

export function transformCourseRedemptionEligibility({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opted to abstract this logic outside of the hook into a separate function. Reason being is more efficient mocking in tests by passing in the mocked and fetched metadata with the expectation that the data we pass in prior to the transform should match the post transform output.

@brobro10000 brobro10000 force-pushed the hu/ent-improve-code-cov-3 branch 4 times, most recently from fd9c80e to bafddf3 Compare April 22, 2024 16:57
jest.clearAllMocks();
});
it.each([
/**
Copy link
Member

Choose a reason for hiding this comment

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

Helpful comments to parse these mock data cases :)

@brobro10000 brobro10000 force-pushed the hu/ent-improve-code-cov-3 branch 3 times, most recently from d6bf0d9 to 29f59b4 Compare April 22, 2024 20:42
Copy link

codecov bot commented Apr 22, 2024

Codecov Report

Attention: Patch coverage is 97.56098% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 84.67%. Comparing base (d36b78a) to head (8c35319).
Report is 226 commits behind head on master.

Files Patch % Lines
src/components/course/data/hooks.jsx 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1065      +/-   ##
==========================================
- Coverage   84.87%   84.67%   -0.20%     
==========================================
  Files         320      386      +66     
  Lines        6399     7947    +1548     
  Branches     1552     1921     +369     
==========================================
+ Hits         5431     6729    +1298     
- Misses        941     1160     +219     
- Partials       27       58      +31     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@brobro10000 brobro10000 marked this pull request as ready for review April 23, 2024 17:29
Copy link
Member

@adamstankiewicz adamstankiewicz left a comment

Choose a reason for hiding this comment

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

Just 2 small nits, but lgtm.

@brobro10000 brobro10000 merged commit c0e341a into master Apr 25, 2024
7 checks passed
@brobro10000 brobro10000 deleted the hu/ent-improve-code-cov-3 branch April 25, 2024 15:40
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.

None yet

2 participants