Files
cloudron-box/src/test/acme2-test.js
Girish Ramakrishnan 510121bf54 remove support for hyphentated domains
this has not been used for a long time
2020-08-15 18:50:07 -07:00

41 lines
1.3 KiB
JavaScript

/* global it:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
var async = require('async'),
database = require('../database.js'),
acme2 = require('../cert/acme2.js'),
expect = require('expect.js');
describe('Acme2', function () {
before(function (done) {
async.series([
database.initialize,
database._clear
], done);
});
after(function (done) {
async.series([
database._clear,
database.uninitialize
], done);
});
describe('getChallengeSubdomain', function () {
it('non-wildcard', function () {
expect(acme2._getChallengeSubdomain('example.com', 'example.com')).to.be('_acme-challenge');
expect(acme2._getChallengeSubdomain('git.example.com', 'example.com')).to.be('_acme-challenge.git');
});
it('wildcard', function () {
expect(acme2._getChallengeSubdomain('*.example.com', 'example.com')).to.be('_acme-challenge');
expect(acme2._getChallengeSubdomain('*.git.example.com', 'example.com')).to.be('_acme-challenge.git');
expect(acme2._getChallengeSubdomain('*.example.com', 'customer.example.com')).to.be('_acme-challenge');
});
});
});