cloudflare/test/test.js

74 lines
5.8 KiB
JavaScript
Raw Normal View History

2016-05-15 17:51:48 +00:00
"use strict";
2016-05-24 21:36:06 +00:00
require("typings-test");
2016-07-31 21:54:13 +00:00
const cflare = require("../dist/index");
const qenv_1 = require("qenv");
2017-01-29 16:27:48 +00:00
let testQenv = new qenv_1.Qenv(process.cwd(), process.cwd() + '/.nogit');
2016-06-21 17:04:43 +00:00
console.log(testQenv.missingEnvVars);
2016-07-31 21:54:13 +00:00
let testCflareAccount = new cflare.CflareAccount();
2016-05-15 17:51:48 +00:00
testCflareAccount.auth({
2016-06-20 20:56:09 +00:00
email: process.env.CF_EMAIL,
key: process.env.CF_KEY
2016-05-15 17:51:48 +00:00
});
2017-01-29 17:05:39 +00:00
let randomPrefix = Math.floor(Math.random() * 2000);
2017-01-29 16:27:48 +00:00
describe('cflare', function () {
describe('.CflareAccount', function () {
describe('.listZones()', function () {
it('should display an entire account', function (done) {
2017-01-29 16:45:48 +00:00
this.timeout(600000);
2016-05-16 01:29:29 +00:00
testCflareAccount.listZones()
2016-07-31 21:54:13 +00:00
.then((responseArg) => {
2016-05-16 01:29:29 +00:00
done();
});
});
});
2017-01-29 16:27:48 +00:00
describe('.getZoneId(domainName)', function () {
it('should get an Cloudflare Id for a domain string', function (done) {
2017-01-29 16:45:48 +00:00
this.timeout(600000);
2017-01-29 16:27:48 +00:00
testCflareAccount.getZoneId('bleu.de')
2016-07-31 21:54:13 +00:00
.then((responseArg) => {
2016-05-16 01:29:29 +00:00
done();
});
});
});
2017-01-29 16:27:48 +00:00
describe('.listRecords(domainName)', function () {
it('should list all records for a specific Domain Name', function (done) {
2017-01-29 16:45:48 +00:00
this.timeout(600000);
2017-01-29 16:27:48 +00:00
testCflareAccount.listRecords('bleu.de')
2016-07-31 21:54:13 +00:00
.then((responseArg) => {
2016-05-16 01:29:29 +00:00
console.log(responseArg);
done();
});
});
});
2017-01-29 16:27:48 +00:00
describe('.createRecord', function () {
it('should create a valid record for a subdomain', function (done) {
2017-01-29 16:45:48 +00:00
this.timeout(600000);
2017-01-29 17:05:39 +00:00
testCflareAccount.createRecord(`${randomPrefix}subdomain.bleu.de`, 'A', '127.0.0.1')
2016-05-25 04:26:48 +00:00
.then(function (responseArg) {
done();
});
});
});
2017-01-29 16:27:48 +00:00
describe('.getRecord', function () {
it('should get a record from Cloudflare', function (done) {
2017-01-29 16:45:48 +00:00
this.timeout(600000);
2017-01-29 16:27:48 +00:00
testCflareAccount.getRecord('bleu.de', 'A')
2016-06-21 17:04:43 +00:00
.then(function (responseArg) {
console.log(responseArg);
done();
});
});
});
2017-01-29 16:27:48 +00:00
describe('.removeRecord', function () {
it('should remove a subdomain record from Cloudflare', function (done) {
2017-01-29 16:45:48 +00:00
this.timeout(600000);
2017-01-29 17:05:39 +00:00
testCflareAccount.removeRecord(`${randomPrefix}subdomain.bleu.de`, 'A')
2016-06-21 17:04:43 +00:00
.then(function (responseArg) {
console.log(responseArg);
done();
});
});
2016-05-24 21:36:06 +00:00
});
2016-05-16 01:29:29 +00:00
});
});
2017-01-29 17:05:39 +00:00
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQix3Q0FBd0M7QUFFeEMsK0JBQTJCO0FBQzNCLElBQUksUUFBUSxHQUFHLElBQUksV0FBSSxDQUFDLE9BQU8sQ0FBQyxHQUFHLEVBQUUsRUFBRSxPQUFPLENBQUMsR0FBRyxFQUFFLEdBQUcsU0FBUyxDQUFDLENBQUE7QUFDakUsT0FBTyxDQUFDLEdBQUcsQ0FBQyxRQUFRLENBQUMsY0FBYyxDQUFDLENBQUE7QUFDcEMsSUFBSSxpQkFBaUIsR0FBRyxJQUFJLE1BQU0sQ0FBQyxhQUFhLEVBQUUsQ0FBQTtBQUNsRCxpQkFB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