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

[Feature Request] Add support for importing mock-api #235

Open
1 task done
Luzifer opened this issue Apr 23, 2023 · 0 comments
Open
1 task done

[Feature Request] Add support for importing mock-api #235

Luzifer opened this issue Apr 23, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@Luzifer
Copy link

Luzifer commented Apr 23, 2023

Tell us about your feature request

As a developer building Go applications I'm used to go test ./... my code during development. In order to assist with HTTP request testing packages like net/http/httptest exist and I'd like to use it to test my implementation against the mock-api.

At the moment the mock-api is an internal package to this CLI and the CLI needs to be started outside my tests in order to have the tests run against the API. This isn't really practicable for automated testing.

To improve this, within this tool there could be a library module to be imported by other developers providing an http.Handler (which should have the same API paths as the official API - i.e. /helix/users) to be used with the httptest.NewServer(handler http.Handler) *httptest.Server helper. By using this my tests can spin up the mock-api within themselves and I don't need to take care of managing it myself outside the test run.

Disclaimer

  • I agree
@Luzifer Luzifer added the enhancement New feature or request label Apr 23, 2023
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

No branches or pull requests

1 participant