fix(client,testing,build): improve TypeScript compatibility for DNS client parsing and test suite
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
import * as plugins from '../ts_server/plugins.js';
|
||||
import { expect, tap } from '@git.zone/tstest/tapbundle';
|
||||
import { tapNodeTools } from '@git.zone/tstest/tapbundle_serverside';
|
||||
import { TapNodeTools } from '@git.zone/tstest/tapbundle_serverside';
|
||||
import * as dnsPacket from 'dns-packet';
|
||||
import * as dgram from 'dgram';
|
||||
|
||||
import * as smartdns from '../ts_server/index.js';
|
||||
|
||||
let dnsServer: smartdns.DnsServer;
|
||||
const tapNodeTools = new TapNodeTools(tap);
|
||||
|
||||
let dnsServer: smartdns.DnsServer | null;
|
||||
|
||||
// Port management for tests
|
||||
let nextHttpsPort = 8600;
|
||||
@@ -29,7 +31,7 @@ async function stopServer(server: smartdns.DnsServer | null | undefined) {
|
||||
try {
|
||||
await server.stop();
|
||||
} catch (e) {
|
||||
console.log('Handled error when stopping server:', e.message || e);
|
||||
console.log('Handled error when stopping server:', e instanceof Error ? e.message : e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +87,7 @@ tap.test('SOA records should be returned for non-existent domains', async () =>
|
||||
const dnsResponse = await responsePromise;
|
||||
|
||||
console.log('✅ SOA response received');
|
||||
const soaAnswers = dnsResponse.answers.filter(a => a.type === 'SOA');
|
||||
const soaAnswers = dnsResponse.answers!.filter(a => a.type === 'SOA');
|
||||
expect(soaAnswers.length).toEqual(1);
|
||||
|
||||
const soaData = (soaAnswers[0] as any).data;
|
||||
@@ -151,7 +153,7 @@ tap.test('Primary nameserver should be configurable', async () => {
|
||||
|
||||
const dnsResponse = await responsePromise;
|
||||
|
||||
const soaAnswers = dnsResponse.answers.filter(a => a.type === 'SOA');
|
||||
const soaAnswers = dnsResponse.answers!.filter(a => a.type === 'SOA');
|
||||
expect(soaAnswers.length).toEqual(1);
|
||||
|
||||
const soaData = (soaAnswers[0] as any).data;
|
||||
@@ -215,7 +217,7 @@ tap.test('Default primary nameserver with FQDN', async () => {
|
||||
|
||||
const dnsResponse = await responsePromise;
|
||||
|
||||
const soaAnswers = dnsResponse.answers.filter(a => a.type === 'SOA');
|
||||
const soaAnswers = dnsResponse.answers!.filter(a => a.type === 'SOA');
|
||||
const soaData = (soaAnswers[0] as any).data;
|
||||
console.log('✅ FQDN primary nameserver:', soaData.mname);
|
||||
|
||||
@@ -225,4 +227,4 @@ tap.test('Default primary nameserver with FQDN', async () => {
|
||||
dnsServer = null;
|
||||
});
|
||||
|
||||
export default tap.start();
|
||||
export default tap.start();
|
||||
|
||||
Reference in New Issue
Block a user