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

Updates usage of co to async function in createScoreboardClient #644

Closed
wants to merge 3 commits into from
Closed

Updates usage of co to async function in createScoreboardClient #644

wants to merge 3 commits into from

Conversation

mslourens
Copy link
Contributor

fixes #632 and #633

@codecov-io
Copy link

codecov-io commented Oct 2, 2019

Codecov Report

Merging #644 into master will decrease coverage by 0.44%.
The diff coverage is 9.09%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #644      +/-   ##
==========================================
- Coverage   81.07%   80.62%   -0.45%     
==========================================
  Files         156      156              
  Lines        4776     4780       +4     
  Branches      184      184              
==========================================
- Hits         3872     3854      -18     
- Misses        855      877      +22     
  Partials       49       49              
Impacted Files Coverage Δ
...online/scoreboard-system/createScoreboardClient.js 1.28% <0.00%> (+1.28%) ⬆️
src/online/scoreboard-system/authenticationFlow.js 2.22% <20.00%> (+2.22%) ⬆️
src/scintillator/nodes/if.js 84.21% <0.00%> (-10.53%) ⬇️
src/app/redux/ReduxState.js 72.05% <0.00%> (-3.36%) ⬇️
src/game/display/player-display.js 75.83% <0.00%> (-1.24%) ⬇️
src/scintillator/loader.js 85.71% <0.00%> (+0.34%) ⬆️
src/scintillator/index.spec.js 100.00% <0.00%> (+0.39%) ⬆️

Continue to review full report at Codecov.

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

Copy link
Member

@dtinth dtinth left a comment

Choose a reason for hiding this comment

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

Unfortunately for this one I have to request some changes. Hope you don’t mind 😅!

// TODO [#632]: Convert the `signUp` method to async function (instead of using `co`) in src/online/scoreboard-system/createScoreboardClient.js
// See issue #575 for more details.
return co(function*() {
const { idToken } = yield* authenticationFlow.signUp(
Copy link
Member

Choose a reason for hiding this comment

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

This one is a bit tricky because we’re using yield* instead of yield. Simply changing it to await doesn't work as we will get back an iterator instead of a Promise. To really fix this you have to convert generator functions in authenticationFlow to async functions. Would you help do that for me?

invariant(typeof username === 'string', 'username must be a string')
invariant(typeof password === 'string', 'password must be a string')
// TODO [#633]: Convert the `loginByUsernamePassword` method to async function (instead of using `co`) in src/online/scoreboard-system/createScoreboardClient.js
return co(function*() {
const { idToken } = yield* authenticationFlow.loginByUsernamePassword(
Copy link
Member

Choose a reason for hiding this comment

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

(Ditto)

Copy link
Member

@dtinth dtinth left a comment

Choose a reason for hiding this comment

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

This looks great now, many thanks!!

@sonarcloud
Copy link

sonarcloud bot commented May 3, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@mslourens mslourens closed this Jan 17, 2022
@mslourens mslourens deleted the 633-convert-co-to-async branch January 17, 2022 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants