Skip to content

Commit

Permalink
fix: add tests that check for error type
Browse files Browse the repository at this point in the history
  • Loading branch information
mShan0 committed Feb 15, 2022
1 parent a25feb1 commit ab7b7cd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 0 additions & 1 deletion test/integration/child-processes/ntlm-connect-node17.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const connection = new Connection(ntlmConfig);

connection.connect(function(err) {
if (err) {
console.error(err);
throw err;
}
connection.close();
Expand Down
3 changes: 3 additions & 0 deletions test/integration/connection-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,9 @@ describe('Ntlm Test', function() {
const child = childProcess.spawnSync(process.execPath,
['./test/integration/child-processes/ntlm-connect-node17.js'],
{ encoding: 'utf8' });
const thrownError = child.stderr;
assert.isTrue(thrownError.includes('ConnectionError'));
assert.isTrue(thrownError.includes('--openssl-legacy-provider'));
assert.strictEqual(child.status, 1);
});

Expand Down
6 changes: 5 additions & 1 deletion test/unit/ntlm-payload-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ if (nodeVersion <= 16 || (process.execArgv.includes('--openssl-legacy-provider')
describe('ntlm payload test node 17 and newer', function() {

it('should throw error when `--openssl-legacy-provider` is not enabled', function() {
assert.throws(() => new NTLMPayload(challenge));
try {
new NTLMPayload(challenge);
} catch (err) {
assert.strictEqual(err.code, 'ERR_OSSL_EVP_UNSUPPORTED');
}
});

it('should respond to challenge when `--openssl-legacy-provider` is enabled`', function() {
Expand Down

0 comments on commit ab7b7cd

Please sign in to comment.