Skip to content

Commit

Permalink
test: remove string literal from assertions
Browse files Browse the repository at this point in the history
PR-URL: #19276
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
  • Loading branch information
Nate-weeks authored and targos committed Mar 27, 2018
1 parent 7e9b7a5 commit 9265f4b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test/parallel/test-crypto-sign-verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ common.expectsError(
.update('Test')
.update('123')
.verify(certPem, s1, 'base64');
assert.strictEqual(verified, true, 'sign and verify (base 64)');
assert.strictEqual(verified, true);
}

{
Expand All @@ -81,14 +81,14 @@ common.expectsError(
.update('Test')
.update('123')
.verify(certPem, s2, 'latin1');
assert.strictEqual(verified, true, 'sign and verify (latin1)');
assert.strictEqual(verified, true);

const verStream = crypto.createVerify('SHA256');
verStream.write('Tes');
verStream.write('t12');
verStream.end('3');
verified = verStream.verify(certPem, s2, 'latin1');
assert.strictEqual(verified, true, 'sign and verify (stream)');
assert.strictEqual(verified, true);
}

{
Expand All @@ -99,14 +99,14 @@ common.expectsError(
.update('Test')
.update('123')
.verify(certPem, s3);
assert.strictEqual(verified, true, 'sign and verify (buffer)');
assert.strictEqual(verified, true);

const verStream = crypto.createVerify('SHA1');
verStream.write('Tes');
verStream.write('t12');
verStream.end('3');
verified = verStream.verify(certPem, s3);
assert.strictEqual(verified, true, 'sign and verify (stream)');
assert.strictEqual(verified, true);
}

// Special tests for RSA_PKCS1_PSS_PADDING
Expand Down Expand Up @@ -177,7 +177,7 @@ common.expectsError(
}, s4);
const saltLengthCorrect = getEffectiveSaltLength(signSaltLength) ===
getEffectiveSaltLength(verifySaltLength);
assert.strictEqual(verified, saltLengthCorrect, 'verify (PSS)');
assert.strictEqual(verified, saltLengthCorrect);
});

// Verification using RSA_PSS_SALTLEN_AUTO should always work
Expand All @@ -188,7 +188,7 @@ common.expectsError(
padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
saltLength: crypto.constants.RSA_PSS_SALTLEN_AUTO
}, s4);
assert.strictEqual(verified, true, 'verify (PSS with SALTLEN_AUTO)');
assert.strictEqual(verified, true);

// Verifying an incorrect message should never work
verified = crypto.createVerify(algo)
Expand All @@ -198,7 +198,7 @@ common.expectsError(
padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
saltLength: crypto.constants.RSA_PSS_SALTLEN_AUTO
}, s4);
assert.strictEqual(verified, false, 'verify (PSS, incorrect)');
assert.strictEqual(verified, false);
}
});
}
Expand All @@ -219,7 +219,7 @@ common.expectsError(
padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
saltLength: vector.salt.length / 2
}, vector.signature, 'hex');
assert.strictEqual(verified, true, 'verify (PSS)');
assert.strictEqual(verified, true);
}

const examples = JSON.parse(fixtures.readSync('pss-vectors.json', 'utf8'));
Expand Down

0 comments on commit 9265f4b

Please sign in to comment.