Files
factorio-clusterio/lib/generateSSLcert.spec.js
T
Hornwitser 44b7d0aa19 Refactor SSL certificate creation
Rewrite the generateSSLcert lib to be async, use the sslCert and
sslPrivKey config entries and invoke it only if needed during master
server startup instead of in the post install script.  Also add note to
the changelog covering both this and the fix in c645fac.
2019-08-23 17:24:39 +02:00

27 lines
952 B
JavaScript

var assert = require("assert");
var fs = require("fs-extra");
var fileOps = require("lib/fileOps");
var generateSSLcert = require("lib/generateSSLcert.js")
describe("generateSSLcert.js(options)", ()=>{
it("Creates a folder with a .crt and .key file in it", async function() {
let certPath = "lib/certTestPlsDelete/cert.crt";
let privKeyPath = "lib/certTestPlsDelete/cert.key";
assert(!await fs.exists(certPath)); // if it already exsits, the test might pass because of leftover data (which is bad)
await generateSSLcert({
// bits:512, // supported, but I just use the default of 2048 for this test
sslCertPath: certPath,
sslPrivKeyPath: privKeyPath,
doLogging: false,
});
assert(await fs.exists(certPath)); // private key
assert(await fs.exists(privKeyPath)); // certificate file
// remove certificates and data from the test
fileOps.deleteFolderRecursiveSync("lib/certTestPlsDelete");
}).timeout(10000);
});