fix(test & plugins): Rename test client variable and export smartrequest in client plugins

This commit is contained in:
Philipp Kunz 2025-05-27 11:39:22 +00:00
parent 1e6d59b5b2
commit f9aa961e01
6 changed files with 26 additions and 15 deletions

View File

@ -1,5 +1,11 @@
# Changelog
## 2025-05-27 - 7.0.1 - fix(test & plugins)
Rename test client variable and export smartrequest in client plugins
- Renamed variable 'testDnsly' to 'testDnsClient' in test/test.client.ts for better clarity.
- Added @push.rocks/smartrequest dependency in package.json and updated ts_client/plugins.ts to export it.
## 2025-05-27 - 7.0.0 - BREAKING CHANGE(core)
Refactor module entry point and update plugin imports; remove deprecated dnsly.plugins, update dependency versions, and adjust test imports

View File

@ -46,6 +46,7 @@
"@push.rocks/smartdelay": "^3.0.1",
"@push.rocks/smartenv": "^5.0.5",
"@push.rocks/smartpromise": "^4.2.3",
"@push.rocks/smartrequest": "^2.1.0",
"@tsclass/tsclass": "^9.2.0",
"@types/dns-packet": "^5.6.5",
"@types/elliptic": "^6.4.18",

5
pnpm-lock.yaml generated
View File

@ -17,6 +17,9 @@ importers:
'@push.rocks/smartpromise':
specifier: ^4.2.3
version: 4.2.3
'@push.rocks/smartrequest':
specifier: ^2.1.0
version: 2.1.0
'@tsclass/tsclass':
specifier: ^9.2.0
version: 9.2.0
@ -2358,7 +2361,7 @@ packages:
engines: {node: '>= 14'}
humanize-ms@1.2.1:
resolution: {integrity: sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==}
resolution: {integrity: sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=}
humanize-number@0.0.2:
resolution: {integrity: sha512-un3ZAcNQGI7RzaWGZzQDH47HETM4Wrj6z6E4TId8Yeq9w5ZKUVB1nrT2jwFheTUjEmqcgTjXDc959jum+ai1kQ==}

View File

@ -2,15 +2,15 @@ import { expect, tap } from '@git.zone/tstest/tapbundle';
import * as smartdns from '../ts_client/index.js';
let testDnsly: smartdns.Smartdns;
let testDnsClient: smartdns.Smartdns;
tap.test('should create an instance of Dnsly', async () => {
testDnsly = new smartdns.Smartdns({});
expect(testDnsly).toBeInstanceOf(smartdns.Smartdns);
testDnsClient = new smartdns.Smartdns({});
expect(testDnsClient).toBeInstanceOf(smartdns.Smartdns);
});
tap.test('should get an A DNS Record', async () => {
return expect(await testDnsly.getRecordsA('dnsly_a.bleu.de')).toEqual([
return expect(await testDnsClient.getRecordsA('dnsly_a.bleu.de')).toEqual([
{
name: 'dnsly_a.bleu.de',
value: '127.0.0.1',
@ -21,7 +21,7 @@ tap.test('should get an A DNS Record', async () => {
});
tap.test('should get an AAAA Record', async () => {
return expect(await testDnsly.getRecordsAAAA('dnsly_aaaa.bleu.de')).toEqual([
return expect(await testDnsClient.getRecordsAAAA('dnsly_aaaa.bleu.de')).toEqual([
{
name: 'dnsly_aaaa.bleu.de',
value: '::1',
@ -32,7 +32,7 @@ tap.test('should get an AAAA Record', async () => {
});
tap.test('should get a txt record', async () => {
return expect(await testDnsly.getRecordsTxt('dnsly_txt.bleu.de')).toEqual([
return expect(await testDnsClient.getRecordsTxt('dnsly_txt.bleu.de')).toEqual([
{
name: 'dnsly_txt.bleu.de',
value: 'sometext_txt',
@ -43,35 +43,35 @@ tap.test('should get a txt record', async () => {
});
tap.test('should, get a mx record for a domain', async () => {
const res = await testDnsly.getRecords('bleu.de', 'MX');
const res = await testDnsClient.getRecords('bleu.de', 'MX');
console.log(res);
});
tap.test('should check until DNS is available', async () => {
return expect(
await testDnsly.checkUntilAvailable('dnsly_txt.bleu.de', 'TXT', 'sometext_txt')
await testDnsClient.checkUntilAvailable('dnsly_txt.bleu.de', 'TXT', 'sometext_txt')
).toBeTrue();
});
tap.test('should check until DNS is available an return false if it fails', async () => {
return expect(
await testDnsly.checkUntilAvailable('dnsly_txt.bleu.de', 'TXT', 'sometext_txt2')
await testDnsClient.checkUntilAvailable('dnsly_txt.bleu.de', 'TXT', 'sometext_txt2')
).toBeFalse();
});
tap.test('should check until DNS is available an return false if it fails', async () => {
return expect(
await testDnsly.checkUntilAvailable('dnsly_txtNotThere.bleu.de', 'TXT', 'sometext_txt2')
await testDnsClient.checkUntilAvailable('dnsly_txtNotThere.bleu.de', 'TXT', 'sometext_txt2')
).toBeFalse();
});
tap.test('should get name server for hostname', async () => {
let result = await testDnsly.getNameServers('bleu.de');
let result = await testDnsClient.getNameServers('bleu.de');
console.log(result);
});
tap.test('should detect dns sec', async () => {
const result = await testDnsly.getRecordsA('lossless.com');
const result = await testDnsClient.getRecordsA('lossless.com');
console.log(result[0]);
expect(result[0].dnsSecEnabled).toBeTrue();
});

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartdns',
version: '7.0.0',
version: '7.0.1',
description: 'A robust TypeScript library providing advanced DNS management and resolution capabilities including support for DNSSEC, custom DNS servers, and integration with various DNS providers.'
}

View File

@ -9,8 +9,9 @@ export { dns };
// pushrocks scope
import * as smartdelay from '@push.rocks/smartdelay';
import * as smartpromise from '@push.rocks/smartpromise';
import * as smartrequest from '@push.rocks/smartrequest';
export { smartdelay, smartenv, smartpromise };
export { smartdelay, smartenv, smartpromise, smartrequest };
import * as tsclass from '@tsclass/tsclass';