@jesseditson/dnsimple
Version:
A Node.JS client for the DNSimple API.
72 lines (71 loc) • 3.71 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const nock = require("nock");
const util_1 = require("./util");
const dnsimple = (0, util_1.createTestClient)();
describe("domain delegation", () => {
const accountId = 1010;
const domainId = "example.com";
describe("#getDomainDelegation", () => {
it("produces a name server list", () => __awaiter(void 0, void 0, void 0, function* () {
nock("https://api.dnsimple.com")
.get("/v2/1010/registrar/domains/example.com/delegation")
.reply((0, util_1.readFixtureAt)("getDomainDelegation/success.http"));
const response = yield dnsimple.registrar.getDomainDelegation(accountId, domainId);
expect(response.data).toEqual([
"ns1.dnsimple.com",
"ns2.dnsimple.com",
"ns3.dnsimple.com",
"ns4.dnsimple.com",
]);
}));
});
describe("#changeDomainDelegation", () => {
const attributes = [
"ns1.dnsimple.com",
"ns2.dnsimple.com",
"ns3.dnsimple.com",
"ns4.dnsimple.com",
];
it("produces a name server list", () => __awaiter(void 0, void 0, void 0, function* () {
nock("https://api.dnsimple.com")
.put("/v2/1010/registrar/domains/example.com/delegation", attributes)
.reply((0, util_1.readFixtureAt)("changeDomainDelegation/success.http"));
const response = yield dnsimple.registrar.changeDomainDelegation(accountId, domainId, attributes);
expect(response.data).toEqual([
"ns1.dnsimple.com",
"ns2.dnsimple.com",
"ns3.dnsimple.com",
"ns4.dnsimple.com",
]);
}));
});
describe("#changeDomainDelegationToVanity", () => {
const attributes = ["ns1.example.com", "ns2.example.com"];
it("produces a name server list", () => __awaiter(void 0, void 0, void 0, function* () {
nock("https://api.dnsimple.com")
.put("/v2/1010/registrar/domains/example.com/delegation/vanity", attributes)
.reply((0, util_1.readFixtureAt)("changeDomainDelegationToVanity/success.http"));
const response = yield dnsimple.registrar.changeDomainDelegationToVanity(accountId, domainId, attributes);
expect(response.data.length).toBe(2);
}));
});
describe("#changeDomainDelegationFromVanity", () => {
it("produces nothing", () => __awaiter(void 0, void 0, void 0, function* () {
nock("https://api.dnsimple.com")
.delete("/v2/1010/registrar/domains/example.com/delegation/vanity")
.reply((0, util_1.readFixtureAt)("changeDomainDelegationFromVanity/success.http"));
const response = yield dnsimple.registrar.changeDomainDelegationFromVanity(accountId, domainId);
expect(response).toEqual({});
}));
});
});
;