@dnslink/js
Version:
The reference implementation for DNSLink in JavaScript. Tested in Node.js and in the Browser.
44 lines (38 loc) • 1.27 kB
JavaScript
// GENERATED FILE. DO NOT EDIT.
var dnslink = (function(exports) {
"use strict";
var _index = require("../index.js");
var _freshTape = require("fresh-tape");
// Note: this is currently a simple test to make sure that the code compiles and
// runs in te browser, not a thorough API test.
_freshTape('basic API test', function (t) {
return (0, _index.resolve)('t02.dnslink.dev', {
endpoints: ['https://1.1.1.1'] // Using a pretty stable doh endpoint to work with.
}).then(data => {
let ttl = data && data.txtEntries && data.txtEntries[0] && data.txtEntries[0].ttl;
t.deepEquals(data, {
txtEntries: [{
value: '/testkey/ABCD',
ttl
}],
links: {
testkey: [{
identifier: 'ABCD',
ttl
}]
},
log: [{
code: 'FALLBACK'
}]
});
});
});
_freshTape('done.', {
skip: typeof window === 'undefined'
}, function () {
window.close();
});
return "default" in exports ? exports.default : exports;
})({});
if (typeof define === 'function' && define.amd) define([], function() { return dnslink; });
else if (typeof module === 'object' && typeof exports==='object') module.exports = dnslink;