-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
test: fix crypto test case to use correct encoding #17956
Conversation
The callback would have errored out anyway due to the incorrect encoding, and that error is not the point of this test case.
Can the error message check be improved so that the test only passes with the correct error? |
It already does not pass, but there is no reason to intentionally use an incorrect encoding here. If we really want to pass an invalid encoding, we should at least add a comment. To me, it was not obvious why the test failed with the message |
@@ -389,7 +389,7 @@ for (const test of TEST_CASES) { | |||
assert.strictEqual(msg, test.plain); | |||
} else { | |||
// assert that final throws if input data could not be verified! | |||
assert.throws(function() { decrypt.final('ascii'); }, errMessages.auth); | |||
assert.throws(() => decrypt.final('hex'), errMessages.auth); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Micro-nit: I'd prefer we keep braces around this arrow function because it makes it clear that we're not intending to return a value here. Totally ignore me if you have strong opinions to the contrary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thank you.
Landed in 5160dd0 |
The callback would have errored out anyway due to the incorrect encoding, and that error is not the point of this test case. PR-URL: nodejs#17956 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
The callback would have errored out anyway due to the incorrect encoding, and that error is not the point of this test case. PR-URL: #17956 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
The callback would have errored out anyway due to the incorrect encoding, and that error is not the point of this test case. PR-URL: #17956 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
The callback would have errored out anyway due to the incorrect encoding, and that error is not the point of this test case. PR-URL: #17956 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
The callback would have errored out anyway due to the incorrect encoding, and that error is not the point of this test case. PR-URL: #17956 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
The callback would have errored out anyway due to the incorrect encoding, and that error is not the point of this test case. PR-URL: #17956 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
The callback would have errored out anyway due to the incorrect encoding, and that error is not the point of this test case. PR-URL: #17956 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
The callback would have errored out anyway due to the incorrect encoding, and that error is not the point of this test case. PR-URL: #17956 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
The callback would have errored out anyway due to the incorrect encoding, and that error is not the point of this test case. PR-URL: #17956 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
The callback would have errored out anyway due to the incorrect encoding, and that error is not the point of this test case.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)