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 integration tests for invalid endpoints #3

Open
josmas opened this issue May 23, 2016 · 2 comments
Open

Add integration tests for invalid endpoints #3

josmas opened this issue May 23, 2016 · 2 comments

Comments

@josmas
Copy link
Member

josmas commented May 23, 2016

Giving a wrong endpoint right now for an integration test will exceed the 2 seconds time that mocha uses by default. I guess the server takes longer than two seconds to time out, so the test has no time to fail. Play with the default time, figure out what happens when the server times out, and make changes to the test (or test suite) accordingly.

@josmas josmas changed the title Add integration tests for wrong endpoints Add integration tests for invalid endpoints May 23, 2016
@drammock
Copy link
Contributor

drammock commented Jun 3, 2016

@josmas if I'm serving on port 8000 I'm seeing at least 5 different error cases during npm test for malformed endpoints, but none of them are timeouts:

  • if I change the BADGR_API_ENDPOINT to something like http://localhost:8001 (or wrongly specify https) then I get Error: connect ECONNREFUSED 127.0.0.1:8001 (or ...443)
  • if I change it to localhost:8000 (without http) I get Error: Invalid protocol: localhost:
  • If I change it to http://localhost:8000/foo or http://www.google.com/ then I get SyntaxError: Unexpected token <
  • if I change it to http://www.google.com (lacking the trailing slash) then I get Error: getaddrinfo ENOTFOUND www.google.comapi-auth www.google.comapi-auth:80

Any of these could be caught by testing, but I'm wondering why I can't replicate the timeout error you're seeing?

@josmas
Copy link
Member Author

josmas commented Jun 3, 2016

mmm, this is odd. I believe it was just passing a well formed URI but not the right one, like your first example. It is not timing out anymore. May be the habitat changes, although I can't think of how that may be affecting. It's the only thing that is different (as far as I can think rn).

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