greenlock-manager-fs.js/test.js

53 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

2019-10-30 07:59:41 +00:00
'use strict';
var Manager = require('./');
var manager = Manager.create({
configFile: 'greenlock-manager-test.delete-me.json'
});
var domains = ['example.com', 'www.example.com'];
async function run() {
await manager.add({
subject: domains[0],
altnames: domains
});
await manager.find({}).then(function(results) {
if (!results.length) {
console.log(results);
throw new Error('should have found all managed sites');
}
});
await manager.find({ subject: 'www.example.com' }).then(function(results) {
if (results.length) {
console.log(results);
throw new Error(
"shouldn't find what doesn't exist, exactly, by subject"
);
}
});
await manager
.find({ altnames: ['www.example.com'] })
.then(function(results) {
if (!results.length) {
console.log(results);
throw new Error('should have found sites matching altname');
}
});
await manager.find({ altnames: ['*.example.com'] }).then(function(results) {
if (results.length) {
console.log(results);
throw new Error(
'should only find an exact (literal) wildcard match'
);
}
});
console.log("PASS");
}
run();