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

Discovered tests that weren't properly running #1570

Merged
merged 2 commits into from May 13, 2015
Merged

Discovered tests that weren't properly running #1570

merged 2 commits into from May 13, 2015

Conversation

seanstrom
Copy link
Contributor

I came across some tests in the test-body.js that didn't seem to be actually asserting anything.
It seems that assertions are only being done if there is an expectBody property and if the value of the expectBody property is a Buffer, otherwise it won't run an assertion and just pass. To make matters even more complicated some of the tests don't give an expectBody property, so I'm not completely sure how to fix those tests. Just wanted to bring this to our attention.

@seanstrom
Copy link
Contributor Author

@simov @nylen @FredKSchott

@simov
Copy link
Member

simov commented May 11, 2015

The last few tests without expectBody are using server.createPostValidator which doesn't return anything useful, and instead makes the assertion on the server. So if you change the resp.write('OK') to resp.write(r) you'll receive the data back in the request's callback, like in the createPostJSONValidator below.

Changing It actually fails in a very few places, those that check for the OK response. It's better to fix it that way IMO.

@seanstrom
Copy link
Contributor Author

Yeah that makes sense.
Also, is there any behavior we want to cover when we do send a PUT or POST request?
It doesn't seem like there is but I was thinking we may want to test the behavior that will always happen when we submit a PUT or POST.

@simov
Copy link
Member

simov commented May 11, 2015

Part of the assertions are already made in createPostValidator, my point was only about returning back the data from the server, just in case anyone want's to use it in their tests, because most of the methods in server are working that way. Now for these specific tests in test-body, you'll probably have to check if it makes sense to define expectBody in some or any of the remaining tests.

@seanstrom
Copy link
Contributor Author

I changed the test helpers and tests to reflect what you mentioned.

@simov
Copy link
Member

simov commented May 13, 2015

👍

simov added a commit that referenced this pull request May 13, 2015
Discovered tests that weren't properly running
@simov simov merged commit 1c6c132 into request:master May 13, 2015
@seanstrom seanstrom deleted the support/fix-testbody-tests branch May 13, 2015 16:09
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.

None yet

2 participants