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

Refactor tests to use abstration around server and client setup for integration tests #180

Open
jfhbrook opened this issue Dec 22, 2015 · 0 comments

Comments

@jfhbrook
Copy link
Owner

Via @mk-pmb :

I think a good solution would be to refactor a lot of these patterns into a test helper module (maybe setup-loopback-listen):

  • Find a random port (retry on EADDRINUSE), or get an OS-assigned address (demo below)
  • If given just options instead of an ecstatic instance, create one with these options. (Might be abstracted to support other (req, res) handlers or middleware.)
  • Configure events and listen. When listening:
    • Lookup port if set by OS
    • Provide a pre-configured instance of request, and the base URL where the ecstatic instance is listening. (Also refs to the server and the ecstatic instance. The latter because a subsequent test shouldn't have to know whether if was supplied or created with options.)

See: #175

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

No branches or pull requests

1 participant