Added function to generate SSL certificate (unused, as of yet)

This commit is contained in:
Danielv123 committed 2018-01-14 21:39:45 +01:00
1 parent 322a1711ab
commit 071a2e6dbe
3 files changed
+72

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
var assert = require("assert");
var fs = require("fs");
var fileOps = require("./fileOps.js");
var generateSSLcert = require("./generateSSLcert.js")
describe("generateSSLcert.js(options)", ()=>{
it("Creates a folder with a .crt and .key file in it", ()=>{
let certPath = "lib/certTestPlsDelete";
assert(!fs.existsSync(certPath)); // if it already exsits, the test might pass because of leftover data (which is bad)
generateSSLcert({
// bits:512, // supported, but I just use the default of 2048 for this test
certificatePath:certPath,
});
assert(fs.existsSync(certPath));
assert(fs.existsSync(certPath+"/cert.key")); // private key
assert(fs.existsSync(certPath+"/cert.crt")); // certificate file
// remove certificates and data from the test
fileOps.deleteFolderRecursiveSync(certPath);
}).timeout(10000);
});