test: fix crypto test case to use correct encoding#17956
test: fix crypto test case to use correct encoding#17956tniessen wants to merge 2 commits intonodejs:masterfrom
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 |
| } 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.
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.
|
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)