2016-05-15 17:51:48 +00:00
|
|
|
"use strict";
|
2016-05-24 21:36:06 +00:00
|
|
|
require("typings-test");
|
2016-05-15 17:51:48 +00:00
|
|
|
var cflare = require("../dist/index");
|
2016-05-16 01:29:29 +00:00
|
|
|
var should = require("should");
|
2016-05-15 17:51:48 +00:00
|
|
|
var nogit = require("../nogit/nogit.json");
|
|
|
|
var 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(function (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(function (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(function (responseArg) {
|
|
|
|
console.log(responseArg);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2016-05-24 21:36:06 +00:00
|
|
|
describe(".createRecord", function () {
|
|
|
|
this.timeout(10000);
|
|
|
|
it("should create a valid record for a domain", function (done) {
|
|
|
|
testCflareAccount.createRecord("bleu.de", "A", "127.0.0.1")
|
|
|
|
.then(function (responseArg) {
|
|
|
|
console.log(responseArg);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2016-05-16 01:29:29 +00:00
|
|
|
});
|
|
|
|
});
|
2016-05-15 17:51:48 +00:00
|
|
|
|
2016-05-24 21:36:06 +00:00
|
|
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsSUFBTyxNQUFNLFdBQVcsZUFBZSxDQUFDLENBQUM7QUFDekMsSUFBSSxNQUFNLEdBQUcsT0FBTyxDQUFDLFFBQVEsQ0FBQyxDQUFDO0FBQy9CLElBQUksS0FBSyxHQUFHLE9BQU8sQ0FBQyxxQkFBcUIsQ0FBQyxDQUFDO0FBRTNDLElBQUksaUJBQWlCLEdBQUcsSUFBSSxNQUFNLENBQUMsYUFBYSxFQUFFLENBQUM7QUFDbkQsaUJBQWlCLENBQUMsSUFBSSxDQUFDO0lBQ25CLEtBQUssRUFBRSxLQUFLLENBQUMsT0FBTztJQUNwQixHQUFHLEVBQUUsS0FBSyxDQUFDLEtBQUs7Q0FDbkIsQ0FBQyxDQUFDO0FBRUgsUUFBUSxDQUFDLFFBQVEsRUFBQztJQUNkLFFBQVEsQ0FBQyxnQkFBZ0IsRUFBQztRQUN0QixRQUFRLENBQUMsY0FBYyxFQUFDO1lBQ3BCLEVBQUUsQ0FBQywyQkFBMkIsRUFBQyxVQUFTLElBQUk7Z0JBQ3hDLElBQUksQ0FBQyxPQUFPLENBQUMsS0FBSyxDQUFDLENBQUM7Z0JBQ3BCLGlCQUFpQixDQUFDLFNBQVMsRUFBRTtxQkFDeEIsSUFBSSxDQUFDLFVBQUMsV0FBVztvQkFDZCxPQUFPLENBQUM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0aW9uKGRvbmUpe1xyXG4gICAgICAgICAgICAgICAgdGhpcy50aW1lb3V0KDEwMDAwKTtcclxuICAgICAgICAgICAgICAgIHRlc3RDZmxhcmVBY2NvdW50Lmxpc3Rab25lcygpXHJcbiAgICAgICAgICAgICAgICAgICAgLnRoZW4oKHJlc3BvbnNlQXJnKT0+e1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhyZXNwb25zZUFyZyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmUoKTtcclxuICAgICAgICAgICAgICAgICAgICB9KVxyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9KTtcclxuICAgICAgICBkZXNjcmliZShcIi5nZXRab25lSWQoZG9tYWluTmFtZSlcIixmdW5jdGlvbigpe1xyXG4gICAgICAgICAgICBpdChcInNob3VsZCBnZXQgYW4gQ2xvdWRmbGFyZSBJZCBmb3IgYSBkb21haW4gc3RyaW5nXCIsZnVuY3Rpb24oZG9uZSl7XHJcbiAgICAgICAgICAgICAgICB0aGlzLnRpbWVvdXQoMTAwMDApXHJcbiAgICAgICAgICAgICAgICB0ZXN0Q2ZsYXJlQWNjb3VudC5nZXRab25lSWQoXCJwdXNoLnJvY2tzXCIpXHJcbiAgICAgICAgICAgICAgICAgICAgLnRoZW4oKHJlc3BvbnNlQXJnKT0+e1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhyZXNwb25zZUFyZyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmUoKTtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSk7XHJcbiAgICAgICAgZGVzY3JpYmUoXCIubGlzdFJlY29yZHMoZG9tYWluTmFtZSlcIixmdW5jdGlvbigpe1xyXG4gICAgICAgICAgICBpdChcInNob3VsZCBsaXN0IGFsbCBy
|