We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
At the moment you are testing the string that gets returned out of the handler function in src/handler.js
handler
src/handler.js
I don't think this is a good practice.
I would say a better test would be to test what data the response.end(data) is called on
response.end(data)
Something like:
tape('handler', function (t) { handler({ url: '/' }, { writeHead: function (status, obj) { t.equal(status, 200); t.equal(obj, ...); }, end: function (data) { t.equal(data, ...); } } }
I'm not sure if that will work, but something similar to that
The text was updated successfully, but these errors were encountered:
Good idea. I think we were trying to test the handler function without mocking the server but your approach makes far more sense.
Sorry, something went wrong.
tbtommyb
No branches or pull requests
At the moment you are testing the string that gets returned out of the
handler
function insrc/handler.js
I don't think this is a good practice.
I would say a better test would be to test what data the
response.end(data)
is called onSomething like:
I'm not sure if that will work, but something similar to that
The text was updated successfully, but these errors were encountered: