2016-11-01 17:27:57 +00:00
|
|
|
import 'typings-test'
|
|
|
|
import * as should from 'should'
|
|
|
|
|
|
|
|
// import the module to test
|
|
|
|
import * as smartacme from '../dist/index'
|
|
|
|
|
2016-11-11 13:17:50 +00:00
|
|
|
describe('smartacme', function () {
|
2016-11-01 19:16:43 +00:00
|
|
|
let testAcme: smartacme.SmartAcme
|
2017-01-01 20:20:12 +00:00
|
|
|
|
2016-11-11 13:17:50 +00:00
|
|
|
it('should create a valid instance', function () {
|
|
|
|
this.timeout(10000)
|
2016-11-01 19:16:43 +00:00
|
|
|
testAcme = new smartacme.SmartAcme()
|
|
|
|
should(testAcme).be.instanceOf(smartacme.SmartAcme)
|
2016-11-07 17:41:52 +00:00
|
|
|
})
|
2017-01-01 20:20:12 +00:00
|
|
|
|
2016-11-11 13:17:50 +00:00
|
|
|
it('should have created keyPair', function () {
|
2017-01-01 17:05:26 +00:00
|
|
|
should(testAcme.acmeUrl).be.of.type('string')
|
2016-11-01 19:16:43 +00:00
|
|
|
})
|
2017-01-01 20:20:12 +00:00
|
|
|
|
2016-11-11 13:17:50 +00:00
|
|
|
it('should register a new account', function (done) {
|
2017-01-01 20:20:12 +00:00
|
|
|
this.timeout(10000)
|
2016-11-11 13:17:50 +00:00
|
|
|
testAcme.createAccount().then(x => {
|
|
|
|
done()
|
|
|
|
}).catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
done(err)
|
|
|
|
})
|
2016-11-01 19:16:43 +00:00
|
|
|
})
|
2017-01-01 20:20:12 +00:00
|
|
|
|
|
|
|
it('should agree to ToS', function(done) {
|
|
|
|
this.timeout(10000)
|
|
|
|
testAcme.agreeTos().then(() => {
|
|
|
|
done()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should request a certifiacate for a domain', function(done) {
|
|
|
|
this.timeout(10000)
|
|
|
|
testAcme.requestCertificate('bleu.de').then(() => {
|
|
|
|
done()
|
|
|
|
})
|
|
|
|
})
|
2016-11-01 17:27:57 +00:00
|
|
|
})
|