netcup-node
Version:
A node wrapper for the Netcup CCP API (https://www.netcup-wiki.de/wiki/CCP_API)
78 lines (77 loc) • 2.58 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.emptyDnsRecord = exports.createEmptyUpdateDnsRecordsResponse = exports.mockLoginResponse = exports.givenSessionId = exports.createEmptyInfoDnsRecordsResponse = exports.createEmptyInfoDnsZoneResponse = exports.createEmptyLoginRequest = exports.createEmptyLoginResponse = exports.createEmptyApiResponse = void 0;
const Actions_1 = require("../src/@types/Actions");
const createEmptyApiResponse = () => ({
serverrequestid: '',
clientrequestid: '',
action: '',
status: '',
statuscode: 0,
shortmessage: '',
longmessage: '',
responsedata: {},
});
exports.createEmptyApiResponse = createEmptyApiResponse;
const createEmptyLoginResponse = () => ({
...(0, exports.createEmptyApiResponse)(),
action: Actions_1.Actions.login,
responsedata: {
apisessionid: '',
},
});
exports.createEmptyLoginResponse = createEmptyLoginResponse;
const createEmptyLoginRequest = () => ({
apikey: '',
apipassword: '',
customernumber: '',
});
exports.createEmptyLoginRequest = createEmptyLoginRequest;
const createEmptyInfoDnsZoneResponse = () => ({
...(0, exports.createEmptyApiResponse)(),
action: Actions_1.Actions.infoDnsZone,
responsedata: {
name: '',
ttl: '',
serial: '',
refresh: '',
retry: '',
expire: '',
dnssecstatus: false,
},
});
exports.createEmptyInfoDnsZoneResponse = createEmptyInfoDnsZoneResponse;
const createEmptyInfoDnsRecordsResponse = () => ({
...(0, exports.createEmptyApiResponse)(),
action: Actions_1.Actions.infoDnsRecords,
responsedata: {
dnsrecords: [],
},
});
exports.createEmptyInfoDnsRecordsResponse = createEmptyInfoDnsRecordsResponse;
exports.givenSessionId = 'testSession';
function mockLoginResponse(api) {
const givenLoginResponse = {
...(0, exports.createEmptyLoginResponse)(),
responsedata: { apisessionid: exports.givenSessionId },
};
jest.spyOn(api, 'login').mockReturnValue(Promise.resolve(givenLoginResponse));
}
exports.mockLoginResponse = mockLoginResponse;
const createEmptyUpdateDnsRecordsResponse = () => ({
...(0, exports.createEmptyApiResponse)(),
action: Actions_1.Actions.updateDnsRecords,
responsedata: {
dnsrecords: [],
},
});
exports.createEmptyUpdateDnsRecordsResponse = createEmptyUpdateDnsRecordsResponse;
exports.emptyDnsRecord = {
id: '',
deleterecord: false,
hostname: '',
priority: '',
state: '',
type: '',
destination: '',
};