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

Add testing #237

Open
ralexstokes opened this issue Sep 9, 2022 · 4 comments
Open

Add testing #237

ralexstokes opened this issue Sep 9, 2022 · 4 comments

Comments

@ralexstokes
Copy link
Owner

Ideally there would be static test vectors that replicate the request/response cycle of a consumer/provider of this API but we don't really have anything like that right now

It would be very nice to add some kind of automatic testing though to make sure things are all good...

@Perelyn-sama
Copy link

I could add tests for each function in the Client Impl. Would it be better in the same file or a separate folder?
I think writing tests for each function would show users how to use interact with them.

@ralexstokes
Copy link
Owner Author

if we are just adding unit tests, then I'd just suggest a new tests module in the same file.

although this file is getting kind of long already so I'd imagine even putting them in a separate file just for manageability

that all being said, I think the type of tests that would be ideal would be more like an integration test -- and rust has idioms for this: https://doc.rust-lang.org/rust-by-example/testing/integration_testing.html

if we did write an integration test for this, we would need to mock out a beacon node and also the HTTP functionality of the client -- both relatively large tasks on their own -- happy to work w/ you on the next steps here if you are interested

@Perelyn-sama
Copy link

Large tasks just mean I have more things to practice rust with, so I'm interested.

I'm not familiar with integration tests in rust yet, so I'll go research and experiment with them.

I would appreciate it if you could highlight the steps we would need to take next to complete this task.

@ralexstokes
Copy link
Owner Author

ok great!

there are a couple routes here and I think the simplest may be to use something like https://docs.rs/httpmock/latest/httpmock/ to mock out the beacon API server

@ralexstokes ralexstokes transferred this issue from ralexstokes/beacon-api-client Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants