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

replace bluebird promises with async/await & superagent with native fetch #63

Merged
merged 8 commits into from
Apr 20, 2023

Conversation

EmmaHegarty
Copy link
Contributor

@EmmaHegarty EmmaHegarty commented Feb 22, 2023

removes dependency on bluebird and superagent, solves #61 and #64

@EmmaHegarty EmmaHegarty added the dependencies Pull requests that update a dependency file label Feb 22, 2023
@codecov-commenter
Copy link

codecov-commenter commented Feb 22, 2023

Codecov Report

Merging #63 (76c4eea) into main (e8bf723) will increase coverage by 2.84%.
The diff coverage is 100.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main      #63      +/-   ##
==========================================
+ Coverage   94.24%   97.09%   +2.84%     
==========================================
  Files          16       16              
  Lines         365      344      -21     
  Branches       67       58       -9     
==========================================
- Hits          344      334      -10     
+ Misses         19        9      -10     
+ Partials        2        1       -1     
Impacted Files Coverage Δ
src/OrsDirections.js 100.00% <ø> (ø)
src/OrsIsochrones.js 100.00% <ø> (ø)
dev_app/components/helloWorld.js 88.88% <100.00%> (-2.03%) ⬇️
src/OrsBase.js 100.00% <100.00%> (+3.84%) ⬆️
src/OrsElevation.js 100.00% <100.00%> (ø)
src/OrsGeocode.js 100.00% <100.00%> (+7.82%) ⬆️
src/OrsOptimization.js 100.00% <100.00%> (ø)
src/OrsPois.js 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

EmmaHegarty and others added 4 commits April 19, 2023 16:59
instead of defining Promises we are now using async-await-syntax
to handle promises.
- fetch() only rejects network errors, other errors need to be
  thrown manually by checking response.ok
- inline return
- throw Error instead of object (old also threw error)
- error now contains fetch Response which still can be consumed

BREAKING-CHANGE: Response object from Error is not superagent
    but fetch response type (https://developer.mozilla.org/en-US/docs/Web/API/Response)
    that can still be consumed

Co-authored-by: Amandus Butzer <amandus.butzer@heigit.org>
- test missing layers parameter in geocode
- use cy.intercept instead of actual API request
- test missing format parameter in directions
- showcase try-catch + async-await syntax instead of .then chaining
- add example on how to connect ot local ors instance
@sonarcloud
Copy link

sonarcloud bot commented Apr 20, 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

@TheGreatRefrigerator TheGreatRefrigerator changed the title replace bluebird promises with async/await replace bluebird promises with async/await & superagent with native fetch Apr 20, 2023
@TheGreatRefrigerator TheGreatRefrigerator merged commit f4f6d55 into main Apr 20, 2023
3 checks passed
@TheGreatRefrigerator TheGreatRefrigerator deleted the native-promise branch April 20, 2023 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file high priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

use fetch API instead of superagent use native promises instead of bluebird
4 participants