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

refactor: sw-2479 promiseMiddleware, catch rejections #1397

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

cdcabrera
Copy link
Member

@cdcabrera cdcabrera commented Aug 28, 2024

What's included

  • refactor: sw-2479 promiseMiddleware, catch rejections

Notes

  • customizes the npm promise-middleware for redux to allow "catching" promise rejections. by doing this we still allow the errors and axios transformations to make their way into the state layer, and we avoid broadcasting it beyond
  • notifications from platform still function despite us leveraging a custom promise middleware. we may have to reevaluate if we decide to use some level of promises with notifications

How to test

Coverage and basic unit test check

  1. update the NPM packages with $ npm install
  2. $ npm test
  3. confirm tests come back clean

Local run check

  1. update the NPM packages with $ npm install
  2. $ npm start
  3. you'll need to emulate a 403 error locally
    • first modify the file ./src/services/rhsm/rhsmServices.js by adding this code @apiMock {Force} 403 to line 1236
    • refresh the page if it doesn't for you, you should now see the opt in display
    • open the browser developer console and confirm that the error [uncaught in promise] error no longer displays
      • you may have to do a before/after compare contrast to catch the promise rejection

Check the build

  1. update the NPM packages with $ npm install
  2. $ npm run build
  3. confirm tests come back clean

Example

...

Updates issue/story

sw-2479

@cdcabrera cdcabrera added platform Contains, or is, platform specific work and issues 202412 project phase labels Aug 28, 2024
@codecov-commenter
Copy link

codecov-commenter commented Aug 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.52%. Comparing base (0402ec4) to head (b6270b1).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1397   +/-   ##
=======================================
  Coverage   91.52%   91.52%           
=======================================
  Files         115      115           
  Lines        4557     4557           
  Branches     1936     1936           
=======================================
  Hits         4171     4171           
  Misses        358      358           
  Partials       28       28           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0402ec4...b6270b1. Read the comment docs.

@cdcabrera cdcabrera merged commit 34ebed5 into RedHatInsights:main Aug 28, 2024
5 of 7 checks passed
@cdcabrera cdcabrera mentioned this pull request Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
202412 project phase platform Contains, or is, platform specific work and issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants