Skip to content

chore: improves test coverage in ws-server package #3928

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
merged 10 commits into from
Jul 16, 2025

Conversation

konstantinabl
Copy link
Contributor

@konstantinabl konstantinabl commented Jul 11, 2025

Description:

The goal of this PR is to improve the test coverage of the ws-server package, more precisely of the three following files:

  • connectionLimiter.ts
  • wsMetricRegistry.ts
  • pollerService.ts

Related issue(s):

Fixes #3908 #3926 #3927

Notes for reviewer:

https://github.com/hiero-ledger/hiero-json-rpc-relay/pull/3928/files#diff-42934bb457ef270c151411688f1ae741d52945651e9c7b74bfe881e815da0c78R30
This change was done, so we can easily test the shouldRateLimitOnMethod method. If the IPRateLimitService is created in the connectionLimiter class itself, its pretty hard to mock it and test the method properly

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Copy link

github-actions bot commented Jul 11, 2025

Test Results

 20 files  ±0  277 suites  +1   18m 1s ⏱️ -10s
702 tests +1  697 ✅ +2  5 💤 ±0  0 ❌  - 1 
718 runs  +1  713 ✅ +2  5 💤 ±0  0 ❌  - 1 

Results for commit 2c53310. ± Comparison against base commit 8870d23.

♻️ This comment has been updated with latest results.

Signed-off-by: Konstantina Blazhukova <[email protected]>
@konstantinabl konstantinabl force-pushed the increase-test-coverage-in-ws-server branch from 259a958 to 84b4c62 Compare July 11, 2025 14:27
Signed-off-by: Konstantina Blazhukova <[email protected]>
@konstantinabl konstantinabl force-pushed the increase-test-coverage-in-ws-server branch from 4d39211 to bec1eda Compare July 11, 2025 14:51
Signed-off-by: Konstantina Blazhukova <[email protected]>
Signed-off-by: Konstantina Blazhukova <[email protected]>
@konstantinabl konstantinabl self-assigned this Jul 15, 2025
@konstantinabl konstantinabl added the enhancement New feature or request label Jul 15, 2025
@konstantinabl konstantinabl added this to the 0.70.0 milestone Jul 15, 2025
Signed-off-by: Konstantina Blazhukova <[email protected]>
@konstantinabl konstantinabl marked this pull request as ready for review July 15, 2025 15:13
@konstantinabl konstantinabl requested review from a team as code owners July 15, 2025 15:13
@konstantinabl konstantinabl requested a review from quiet-node July 15, 2025 15:13
@konstantinabl konstantinabl changed the title chore: creates tests for connectionLimiter file chore: improves test coverage in ws-swerver package Jul 15, 2025
Signed-off-by: Konstantina Blazhukova <[email protected]>
Signed-off-by: Konstantina Blazhukova <[email protected]>
@konstantinabl konstantinabl changed the title chore: improves test coverage in ws-swerver package chore: improves test coverage in ws-server package Jul 15, 2025
quiet-node
quiet-node previously approved these changes Jul 15, 2025
Copy link
Contributor

@quiet-node quiet-node left a comment

Choose a reason for hiding this comment

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

LGTM! Nice set of tests! Great work as always!

acuarica
acuarica previously approved these changes Jul 15, 2025
Signed-off-by: Konstantina Blazhukova <[email protected]>
@konstantinabl konstantinabl dismissed stale reviews from acuarica and quiet-node via 2c53310 July 16, 2025 12:17
@simzzz simzzz self-requested a review July 16, 2025 14:02
@konstantinabl konstantinabl merged commit cd2479f into main Jul 16, 2025
64 of 68 checks passed
@konstantinabl konstantinabl deleted the increase-test-coverage-in-ws-server branch July 16, 2025 14:09
Copy link

codecov bot commented Jul 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

@@            Coverage Diff             @@
##             main    #3928      +/-   ##
==========================================
+ Coverage   86.82%   88.18%   +1.36%     
==========================================
  Files          87       87              
  Lines        5086     5037      -49     
  Branches     1038     1020      -18     
==========================================
+ Hits         4416     4442      +26     
+ Misses        395      330      -65     
+ Partials      275      265      -10     
Flag Coverage Δ
config-service 95.78% <ø> (+1.74%) ⬆️
relay 81.27% <ø> (+0.06%) ⬆️
server 80.81% <ø> (ø)
ws-server 83.86% <100.00%> (+22.85%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ackages/ws-server/src/metrics/connectionLimiter.ts 85.33% <100.00%> (+50.26%) ⬆️
packages/ws-server/src/service/pollerService.ts 83.78% <ø> (+13.51%) ⬆️

... and 12 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increase test coverage of connectionLimiter.ts
4 participants