Files
factorio-clusterio/test/lib/generateSSLcert.js
T
Hornwitser bf5a4a8a9c Split up into multiple packages with Lerna
Split up codebase into the packages @clsterio/lib, @clusterio/master,
@clusterio/slave, and @clusterio/ctl using lerna to manage them.  This
will allow deployment to use only the parts needed reducing install
size, and better separate the code into shared library, master, slave
and control.
2020-09-21 18:00:07 +02:00

35 lines
983 B
JavaScript

"use strict";
const assert = require("assert");
const fs = require("fs-extra");
const path = require("path");
const generateSSLcert = require("@clusterio/master/src/generate_ssl_cert");
describe("generateSSLcert.js(options)", function() {
let testDir = path.join("temp", "test", "certTest");
before(async function() {
await fs.remove(testDir);
});
it("Creates a folder with a .crt and .key file in it", async function() {
this.timeout(1000);
// eslint-disable-next-line no-process-env
if (process.env.FAST_TEST) {
this.skip();
}
let certPath = path.join(testDir, "cert.crt");
let privKeyPath = path.join(testDir, "cert.key");
await generateSSLcert({
bits: 512, // This is too small for real world usage, but faster to test
sslCertPath: certPath,
sslPrivKeyPath: privKeyPath,
doLogging: false,
});
assert(await fs.exists(certPath), "cert file was not created");
assert(await fs.exists(privKeyPath), "key file was not created");
});
});