From e11c58419d822ac200e7e56b45f38d3b3e8d6336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20BE=CC=81RARD?= Date: Sat, 8 Jun 2013 17:33:32 +0200 Subject: [PATCH] improve getModulus unit test --- test/pem.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/test/pem.js b/test/pem.js index d6770549..f1dc7e04 100644 --- a/test/pem.js +++ b/test/pem.js @@ -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(); }); });