2016-11-15 20:39:21 +00:00
|
|
|
import 'typings-test'
|
2017-01-26 23:11:13 +00:00
|
|
|
import { expect } from 'smartchai'
|
2016-11-15 20:39:21 +00:00
|
|
|
|
|
|
|
import * as dnsly from '../dist/index'
|
|
|
|
|
|
|
|
let testDnsly: dnsly.Dnsly
|
|
|
|
|
|
|
|
describe('dnsly', function () {
|
|
|
|
it('should create an instance of Dnsly', function () {
|
|
|
|
testDnsly = new dnsly.Dnsly('google')
|
2017-01-26 23:11:13 +00:00
|
|
|
expect(testDnsly).to.be.instanceOf(dnsly.Dnsly)
|
2016-11-15 20:39:21 +00:00
|
|
|
})
|
|
|
|
|
2017-01-26 23:11:13 +00:00
|
|
|
it('should get an A DNS Record', function () {
|
|
|
|
return expect(testDnsly.getRecordA('dnsly_a.bleu.de')).to.eventually.deep.equal([{
|
|
|
|
name: 'dnsly_a.bleu.de',
|
|
|
|
value: '127.0.0.1',
|
|
|
|
type: 'A'
|
|
|
|
}])
|
|
|
|
})
|
2016-11-15 20:39:21 +00:00
|
|
|
|
2017-01-26 23:11:13 +00:00
|
|
|
it('should get an AAAA Record', function () {
|
|
|
|
return expect(testDnsly.getRecordAAAA('dnsly_aaaa.bleu.de')).to.eventually.deep.equal([{
|
|
|
|
name: 'dnsly_aaaa.bleu.de',
|
|
|
|
value: '::1',
|
|
|
|
type: 'AAAA'
|
|
|
|
}])
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should get a txt record', function() {
|
|
|
|
return expect(testDnsly.getRecordTxt('dnsly_txt.bleu.de')).to.eventually.deep.equal([{
|
|
|
|
chunked: ['sometext_txt'],
|
|
|
|
name: 'dnsly_txt.bleu.de',
|
|
|
|
value: 'sometext_txt',
|
|
|
|
type: 'TXT'
|
|
|
|
}])
|
2016-11-15 20:39:21 +00:00
|
|
|
})
|
|
|
|
|
2016-11-15 21:40:40 +00:00
|
|
|
it('should, get a mx record for a domain', function (done) {
|
|
|
|
testDnsly.getRecord('google.com', 'MX').then(res => {
|
|
|
|
console.log(res)
|
|
|
|
done()
|
|
|
|
}).catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
done(err)
|
|
|
|
})
|
|
|
|
|
2016-11-15 20:39:21 +00:00
|
|
|
})
|
2017-01-26 23:11:13 +00:00
|
|
|
|
|
|
|
it('should check until DNS is available', function() {
|
|
|
|
return expect(testDnsly.checkUntilAvailable('dnsly_txt.bleu.de','TXT','sometext_txt')).to.eventually.be.true
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should check until DNS is available an return false if it fails', function() {
|
|
|
|
this.timeout(30000)
|
|
|
|
return expect(testDnsly.checkUntilAvailable('dnsly_txt.bleu.de','TXT','sometext_txt2')).to.eventually.be.false
|
|
|
|
})
|
2016-11-15 20:39:21 +00:00
|
|
|
})
|