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

test(SPV-1079): add endpoint tests for get merkleroots #745

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

dzolt-4chain
Copy link
Contributor

@dzolt-4chain dzolt-4chain commented Oct 17, 2024

Pull Request Checklist

  • πŸ“– I created my PR using provided : CODE_STANDARDS
  • πŸ“– I have read the short Code of Conduct: CODE_OF_CONDUCT
  • 🏠 I tested my changes locally.
  • βœ… I have provided tests for my changes.
  • πŸ“ I have used conventional commits.
  • πŸ“— I have updated any related documentation.
  • πŸ’Ύ PR was issued based on the Github or Jira issue.

@dzolt-4chain dzolt-4chain requested a review from a team as a code owner October 17, 2024 11:01
Copy link

Manual Tests

ℹ️ Remember to ask team members to perform manual tests and to assign tested label after testing.

@codecov-commenter
Copy link

codecov-commenter commented Oct 17, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 6.94444% with 67 lines in your changes missing coverage. Please review.

Project coverage is 45.80%. Comparing base (febd039) to head (f2fd8b2).

Files with missing lines Patch % Lines
...ions/testabilities/fixture_block_header_service.go 0.00% 40 Missing ⚠️
...ons/testabilities/fixture_spvwallet_application.go 11.11% 23 Missing and 1 partial ⚠️
...ions/testabilities/assert_spvwallet_application.go 0.00% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #745      +/-   ##
==========================================
- Coverage   46.13%   45.80%   -0.33%     
==========================================
  Files         328      329       +1     
  Lines       16700    16770      +70     
==========================================
- Hits         7705     7682      -23     
- Misses       8421     8515      +94     
+ Partials      574      573       -1     
Flag Coverage Ξ”
unittests 45.80% <6.94%> (-0.33%) ⬇️

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

Files with missing lines Coverage Ξ”
actions/merkleroots/routes.go 100.00% <100.00%> (ΓΈ)
actions/register.go 100.00% <100.00%> (ΓΈ)
...ions/testabilities/assert_spvwallet_application.go 65.07% <0.00%> (-3.26%) ⬇️
...ons/testabilities/fixture_spvwallet_application.go 74.82% <11.11%> (-15.36%) ⬇️
...ions/testabilities/fixture_block_header_service.go 0.00% <0.00%> (ΓΈ)

... and 3 files with indirect coverage changes


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 febd039...f2fd8b2. Read the comment docs.

Comment on lines 119 to 122
res, _ := client.R().
SetHeader("Content-Type", "application/json").
SetError(resErr).
Get(tt.bhsURL)
Copy link

Choose a reason for hiding this comment

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

pleae add error check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

Choose a reason for hiding this comment

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

This is exception where we don't need add error checks, because given.HttpClient() is returning special client that will fail a tests if there will be any error before any error will be returned.

Copy link
Contributor

Choose a reason for hiding this comment

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

please please please
Remove those tests now, as the new one are much better then that.

res, err := client.R().
SetHeader("Content-Type", "application/json").
Get(url)
require.NoError(t, err, "Unexpected error occurred while getting MerkleRoots")
Copy link
Contributor

Choose a reason for hiding this comment

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

it is not needed for those tests, please read the documentation of given.HttpClient method, if it's not enaugh clear, then read below.

The given.HttpClient method is adding error handler to resty so that any unexpected error that could be returned here will fail the tests so you don't need to make any assumptions about returned error and can focus only on res.

Comment on lines 119 to 122
res, _ := client.R().
SetHeader("Content-Type", "application/json").
SetError(resErr).
Get(tt.bhsURL)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is exception where we don't need add error checks, because given.HttpClient() is returning special client that will fail a tests if there will be any error before any error will be returned.

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

Successfully merging this pull request may close these issues.

5 participants