@dnslink/test
Version:
A programming-language independent test harness for DNSLink implementations.
39 lines (34 loc) • 953 B
text/typescript
import { getCommand, startServer, runTests, SETUP, SetupEntry } from '@dnslink/test';
const c = new AbortController();
startServer()
.then(({ serverOpts, close }) => {
// $ExpectType number
serverOpts.udp;
// $ExpectType number
serverOpts.tcp;
// $ExpectType number
serverOpts.doh;
close().then(() => {});
});
getCommand(['hello'], c.signal)
.then(cmd => {
const tests = runTests (cmd, { error: false }, { only: ['t01'], skip: ['t10'] });
tests.onFinish(() => {});
});
const domainEntry = SETUP['some.domain'];
if (domainEntry !== undefined) {
const rTypeTXT = domainEntry[16];
if (rTypeTXT !== undefined) {
// $ExpectType SetupEntry[]
rTypeTXT;
const firstEntry = rTypeTXT[0];
// $ExpectType string[]
firstEntry.data;
// $ExpectType number
firstEntry.ttl;
// $ExpectType number
firstEntry.type;
}
// $ExpectType SetupEntry[] | undefined
domainEntry.RCODE;
}