cloudflare/test/test.ts

72 lines
2.6 KiB
TypeScript
Raw Normal View History

2016-05-24 21:36:06 +00:00
import "typings-test";
2016-05-15 17:51:48 +00:00
import cflare = require("../dist/index");
2016-05-16 01:29:29 +00:00
let should = require("should");
2016-05-15 17:51:48 +00:00
let nogit = require("../nogit/nogit.json");
let testCflareAccount = new cflare.CflareAccount();
testCflareAccount.auth({
email: nogit.cfemail,
key: nogit.cfkey
});
2016-05-16 01:29:29 +00:00
describe("cflare",function(){
describe(".CflareAccount",function(){
describe(".listZones()",function(){
it("should display an account",function(done){
this.timeout(10000);
testCflareAccount.listZones()
.then((responseArg)=>{
console.log(responseArg);
done();
})
});
});
describe(".getZoneId(domainName)",function(){
it("should get an Cloudflare Id for a domain string",function(done){
2016-05-24 21:36:06 +00:00
this.timeout(10000)
2016-05-16 01:29:29 +00:00
testCflareAccount.getZoneId("push.rocks")
.then((responseArg)=>{
console.log(responseArg);
done();
});
});
});
describe(".listRecords(domainName)",function(){
it("should list all records for a specific Domain Name",function(done){
2016-05-24 21:36:06 +00:00
this.timeout(10000);
2016-05-16 01:29:29 +00:00
testCflareAccount.listRecords("push.rocks")
.then((responseArg) => {
console.log(responseArg);
done();
});
});
})
2016-05-24 21:36:06 +00:00
describe(".createRecord",function(){
this.timeout(10000);
2016-05-25 04:26:48 +00:00
it("should create a valid record for a level 2 domain",function(done){
2016-05-24 21:36:06 +00:00
testCflareAccount.createRecord("bleu.de","A","127.0.0.1")
.then(function(responseArg){
console.log(responseArg);
done();
});
});
2016-05-25 04:26:48 +00:00
it("should create a valid record for a subdomain",function(done){
testCflareAccount.createRecord("subdomain.bleu.de","A","127.0.0.1")
.then(function(responseArg){
console.log(responseArg);
done();
});
});
2016-05-24 21:36:06 +00:00
});
describe(".removeRecord",function(){
2016-05-25 04:26:48 +00:00
/*it("should remove a record from Cloudflare",function(done){
2016-05-24 21:36:06 +00:00
testCflareAccount.removeRecord()
.then(function(responseArg){
console.log(responseArg);
done();
2016-05-25 04:26:48 +00:00
});
});*/
2016-05-24 21:36:06 +00:00
});
2016-05-16 01:29:29 +00:00
})
});