2017-07-18 13:45:06 +00:00
|
|
|
import { expect, tap } from 'tapbundle'
|
2016-11-15 20:39:21 +00:00
|
|
|
|
2017-07-31 14:33:57 +00:00
|
|
|
import * as dnsly from '../ts/index'
|
2016-11-15 20:39:21 +00:00
|
|
|
|
|
|
|
let testDnsly: dnsly.Dnsly
|
|
|
|
|
2017-07-18 13:45:06 +00:00
|
|
|
tap.test('should create an instance of Dnsly', async () => {
|
|
|
|
testDnsly = new dnsly.Dnsly('google')
|
|
|
|
expect(testDnsly).to.be.instanceOf(dnsly.Dnsly)
|
|
|
|
})
|
2016-11-15 20:39:21 +00:00
|
|
|
|
2017-07-18 13:45:06 +00:00
|
|
|
tap.test('should get an A DNS Record', async () => {
|
|
|
|
return expect(testDnsly.getRecordA('dnsly_a.bleu.de')).to.eventually.deep.equal([{
|
|
|
|
name: 'dnsly_a.bleu.de',
|
|
|
|
value: '127.0.0.1',
|
|
|
|
type: 'A'
|
|
|
|
}])
|
|
|
|
})
|
2017-01-26 23:11:13 +00:00
|
|
|
|
2017-07-18 13:45:06 +00:00
|
|
|
tap.test('should get an AAAA Record', async () => {
|
|
|
|
return expect(testDnsly.getRecordAAAA('dnsly_aaaa.bleu.de')).to.eventually.deep.equal([{
|
|
|
|
name: 'dnsly_aaaa.bleu.de',
|
|
|
|
value: '::1',
|
|
|
|
type: 'AAAA'
|
|
|
|
}])
|
|
|
|
})
|
2016-11-15 20:39:21 +00:00
|
|
|
|
2017-07-18 13:45:06 +00:00
|
|
|
tap.test('should get a txt record', async () => {
|
|
|
|
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 21:40:40 +00:00
|
|
|
|
2017-07-18 13:45:06 +00:00
|
|
|
tap.test('should, get a mx record for a domain', async () => {
|
|
|
|
let res = await testDnsly.getRecord('google.com', 'MX')
|
|
|
|
console.log(res)
|
|
|
|
})
|
2017-01-26 23:11:13 +00:00
|
|
|
|
2017-07-18 13:45:06 +00:00
|
|
|
tap.test('should check until DNS is available', async () => {
|
|
|
|
return expect(testDnsly.checkUntilAvailable('dnsly_txt.bleu.de', 'TXT', 'sometext_txt')).to.eventually.be.true
|
|
|
|
})
|
2017-01-26 23:11:13 +00:00
|
|
|
|
2017-07-18 13:45:06 +00:00
|
|
|
tap.test('should check until DNS is available an return false if it fails', async () => {
|
|
|
|
return expect(testDnsly.checkUntilAvailable('dnsly_txt.bleu.de', 'TXT', 'sometext_txt2')).to.eventually.be.false
|
|
|
|
})
|
2017-01-26 23:37:32 +00:00
|
|
|
|
2017-07-18 13:45:06 +00:00
|
|
|
tap.test('should check until DNS is available an return false if it fails', async () => {
|
|
|
|
return expect(
|
|
|
|
testDnsly.checkUntilAvailable('dnsly_txtNotThere.bleu.de', 'TXT', 'sometext_txt2')
|
|
|
|
).to.eventually.be.false
|
2016-11-15 20:39:21 +00:00
|
|
|
})
|
2017-07-18 13:45:06 +00:00
|
|
|
|
|
|
|
tap.start()
|