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

EDSC-4280 fixes issues with view all facet util functions #1845

Merged
merged 2 commits into from
Jan 8, 2025

Conversation

daniel-zamora
Copy link
Contributor

@daniel-zamora daniel-zamora commented Dec 31, 2024

Overview

What is the feature?

Fixes issue where empty string titles in cmr metadata causes edsc to throw errors when trying to call toUpperCase.

What is the Solution?

Added util function to safely do this, refactored relevant to use new util.

What areas of the application does this impact?

getStartingLetters and buildOrganizedFacets in facets.js util
Added tests for these two functions and new util function getNormalizedFirstLetter

Testing

A little tricky to test, in environment as it needs bad facet metadata. However locally you can add on line 89 in viewAllFacets.js reducer to replicate the problem,

      payload.facets = payload.facets.map((facetCategory) => {
        if (facetCategory.title === 'Projects') {
          return {
            ...facetCategory,
            children: [...facetCategory.children, { title: '' }]
          }
        }

        return facetCategory
      })

Checklist

  • I have added automated tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Copy link

codecov bot commented Dec 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.77%. Comparing base (3f1a79a) to head (5822899).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1845      +/-   ##
==========================================
- Coverage   93.78%   93.77%   -0.01%     
==========================================
  Files         778      778              
  Lines       18885    18888       +3     
  Branches     4868     4850      -18     
==========================================
+ Hits        17711    17712       +1     
+ Misses       1099     1097       -2     
- Partials       75       79       +4     

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

@trevorlang trevorlang self-requested a review January 7, 2025 20:22
static/src/js/util/facets.js Show resolved Hide resolved
@daniel-zamora daniel-zamora merged commit 1362ddd into main Jan 8, 2025
11 checks passed
@daniel-zamora daniel-zamora deleted the EDSC-4280 branch January 8, 2025 14:42
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