Skip to content

Commit

Permalink
improve getModulus unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
polymorf committed Jun 8, 2013
1 parent f1498ce commit e11c584
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions test/pem.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,16 +259,24 @@ exports["General Tests"] = {
"Get modulus from certificate": function(test){
pem.createCertificate(function(error, data){
var certificate = (data && data.certificate || "").toString();
var key = (data && data.clientKey || "").toString();
test.ifError(error);
test.ok(certificate);

pem.getModulus(certificate, function(error, data){
var modulus = (data && data.modulus || "").toString();
var certmodulus = (data && data.modulus || "").toString();
test.ifError(error);
test.ok(modulus);
test.ok(modulus.match(/^[0-9A-F]*$/));
test.ok(certmodulus);
test.ok(certmodulus.match(/^[0-9A-F]*$/));
pem.getModulus(certificate, function(error, data){
var keymodulus = (data && data.modulus || "").toString();
test.ifError(error);
test.ok(keymodulus);
test.ok(keymodulus.match(/^[0-9A-F]*$/));
test.ok(keymodulus == certmodulus);
test.done();
});

test.done();
});

});
Expand Down

0 comments on commit e11c584

Please sign in to comment.