Files
smartacme/test/test.ts

43 lines
1.3 KiB
TypeScript
Raw Normal View History

2019-01-06 20:41:21 +01:00
import { tap, expect } from '@pushrocks/tapbundle';
2019-01-08 20:45:35 +01:00
import { Qenv } from '@pushrocks/qenv';
const testQenv = new Qenv('./', './.nogit/');
2016-11-01 18:27:57 +01:00
import * as smartacme from '../ts/index';
2017-01-22 21:50:04 +01:00
let smartAcmeInstance: smartacme.SmartAcme;
2016-11-01 18:27:57 +01:00
2018-08-12 20:58:59 +02:00
tap.test('should create a valid instance of SmartAcme', async () => {
2019-01-08 20:45:35 +01:00
smartAcmeInstance = new smartacme.SmartAcme({
2019-01-06 20:41:21 +01:00
accountEmail: 'domains@lossless.org',
accountPrivateKey: null,
2019-01-09 00:01:01 +01:00
mongoDescriptor: {
2019-01-15 23:59:21 +01:00
mongoDbName: testQenv.getEnvVarRequired('MONGODB_DATABASE'),
mongoDbPass: testQenv.getEnvVarRequired('MONGODB_PASSWORD'),
mongoDbUrl: testQenv.getEnvVarRequired('MONGODB_URL')
2019-01-09 00:01:01 +01:00
},
2019-01-06 20:41:21 +01:00
removeChallenge: async (...args) => {
console.log(args);
},
setChallenge: async (...args) => {
console.log(args);
2019-01-08 20:45:35 +01:00
},
2019-02-06 09:47:33 +01:00
environment: 'integration'
2019-01-06 20:41:21 +01:00
});
2019-01-08 20:45:35 +01:00
await smartAcmeInstance.init();
2019-01-09 00:01:01 +01:00
// await smartAcmeInstance.getCertificateForDomain('bleu.de');
2018-08-12 20:58:59 +02:00
});
2017-01-22 21:50:04 +01:00
2019-01-13 02:10:00 +01:00
tap.test('certmatcher should correctly match domains', async () => {
2019-02-06 09:47:33 +01:00
const certMatcherMod = await import('../ts/smartacme.classes.certmatcher');
2019-01-13 02:10:00 +01:00
const certMatcher = new certMatcherMod.CertMatcher();
const matchedCert = certMatcher.getCertificateDomainNameByDomainName('level3.level2.level1');
expect(matchedCert).to.equal('level2.level1');
});
2019-01-12 21:06:29 +01:00
tap.test('should stop correctly', async () => {
await smartAcmeInstance.stop();
});
2018-08-12 20:58:59 +02:00
tap.start();