Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add tests for node/heart.ts #5122

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

Merged
jsjoeio merged 9 commits into main from jsjoeio/add-heart-tests
Apr 26, 2022
Merged

feat: add tests for node/heart.ts #5122

jsjoeio merged 9 commits into main from jsjoeio/add-heart-tests
Apr 26, 2022

Conversation

Copy link
Contributor

@jsjoeio jsjoeio commented Apr 21, 2022

This PR adds tests to increase coverage for src/node/heart.ts.

Related to #5121

@jsjoeio jsjoeio added the testing Anything related to testing label Apr 21, 2022
@jsjoeio jsjoeio self-assigned this Apr 21, 2022
Copy link

github-actions bot commented Apr 21, 2022
edited
Loading

✨ code-server docs for PR #5122 is ready! It will be updated on every commit.

Copy link

codecov bot commented Apr 21, 2022
edited
Loading

Codecov Report

Merging #5122 (7b11efb) into main (ed7bd2e) will increase coverage by 0.39%.
The diff coverage is 100.00%.

Impacted file tree graph

@@ Coverage Diff @@
## main #5122 +/- ##
==========================================
+ Coverage 71.33% 71.73% +0.39% 
==========================================
 Files 30 30 
 Lines 1685 1684 -1 
 Branches 374 374 
==========================================
+ Hits 1202 1208 +6 
+ Misses 413 407 -6 
+ Partials 70 69 -1 
Impacted Files Coverage Δ
src/node/heart.ts 96.29% <100.00%> (+24.86%) ⬆️

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 ed7bd2e...7b11efb. Read the comment docs.

@jsjoeio jsjoeio temporarily deployed to npm April 21, 2022 22:06 Inactive
Copy link

github-actions bot commented Apr 21, 2022
edited
Loading

✨ code-server dev build published to npm for PR #5122!

  • Last publish status: success
  • Commit: 7b11efb

To install in a local project, run:

npm install @coder/code-server-pr@5122

To install globally, run:

npm install -g @coder/code-server-pr@5122

@jsjoeio jsjoeio force-pushed the jsjoeio/add-heart-tests branch from 436fca7 to 0e4c062 Compare April 22, 2022 16:23
Joe Previte added 2 commits April 22, 2022 20:36
To make it easier to test, I extract heartbeatTimer into it's own
function.
@jsjoeio jsjoeio force-pushed the jsjoeio/add-heart-tests branch from 5024c67 to 3934ca3 Compare April 22, 2022 20:40
@jsjoeio jsjoeio temporarily deployed to npm April 22, 2022 20:44 Inactive
@jsjoeio jsjoeio marked this pull request as ready for review April 22, 2022 20:53
@jsjoeio jsjoeio requested a review from a team April 22, 2022 20:53
@jsjoeio jsjoeio added this to the April 2022 milestone Apr 22, 2022
@jsjoeio jsjoeio temporarily deployed to npm April 22, 2022 20:58 Inactive
Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

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

🎉

Comment on lines +49 to +51
// HACK@jsjoeio - beat has some async logic but is not an async method
// Therefore, we have to create an artificial wait in order to make sure
// all async code has completed before asserting
Copy link
Member

@code-asher code-asher Apr 25, 2022

Choose a reason for hiding this comment

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

This looks good to me for now. Maybe long-term we can make beat async, at least up to the file write.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! I briefly looked into it for this PR but since it happens in a request, I wasn't sure if changing it here to make the handler async would causes so I didn't.

Copy link
Member

@code-asher code-asher Apr 25, 2022

Choose a reason for hiding this comment

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

Ah yeah I think the move would be to only await in tests. For other uses we can leave them as-is (since we do not want to delay the request to write to the heartbeat file).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah gotcha! I did use await when I was first writing the tests but TS said it would have no effect lol but I guess that's because it couldn't infer the callback logic? I'm not sure lol

Copy link
Member

@code-asher code-asher Apr 26, 2022

Choose a reason for hiding this comment

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

Ahh yup we would need to make beat async first and then add the await in the tests.

jsjoeio reacted with thumbs up emoji
Copy link
Member

@code-asher code-asher Apr 26, 2022

Choose a reason for hiding this comment

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

But I think the current workaround is chill

jsjoeio reacted with thumbs up emoji
@jsjoeio jsjoeio temporarily deployed to npm April 25, 2022 22:55 Inactive
Co-authored-by: Asher <ash@coder.com>
@jsjoeio jsjoeio temporarily deployed to npm April 25, 2022 23:43 Inactive
@jsjoeio jsjoeio enabled auto-merge (squash) April 25, 2022 23:54
@jsjoeio jsjoeio temporarily deployed to npm April 25, 2022 23:59 Inactive
@jsjoeio jsjoeio disabled auto-merge April 26, 2022 00:09
@jsjoeio jsjoeio enabled auto-merge (squash) April 26, 2022 00:16
@jsjoeio jsjoeio temporarily deployed to npm April 26, 2022 16:21 Inactive
@jsjoeio jsjoeio merged commit 18ff996 into main Apr 26, 2022
@jsjoeio jsjoeio deleted the jsjoeio/add-heart-tests branch April 26, 2022 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@code-asher code-asher code-asher approved these changes

Labels
testing Anything related to testing
Projects
None yet
Milestone
4.4.0
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /