Skip to content

Commit 2ee49d9

Browse files
committed
chore: wip
1 parent d5f2fdf commit 2ee49d9

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

storage/framework/core/whois/src/index.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { SocksClientOptions } from 'socks'
22
import type { ProxyData, WhoIsOptions, WhoIsResponse } from './types'
33
import Net from 'node:net'
4+
import { log } from '@stacksjs/logging'
45
import fetch from 'node-fetch'
56
import { SocksClient } from 'socks'
67
import { IANA_CHK_URL, PARAMETERS, SERVERS } from './constants'
@@ -268,16 +269,16 @@ export async function whois(
268269
if (server === '') {
269270
let serverData = getWhoIsServer(tld as keyof typeof SERVERS)
270271
if (!serverData) {
271-
console.debug(`No WhoIs server found for TLD: ${tld}! Attempting IANA WhoIs database for server!`)
272+
log.debug(`No WhoIs server found for TLD: ${tld}! Attempting IANA WhoIs database for server!`)
272273
serverData = await findWhoIsServer(tld)
273274
if (!serverData) {
274-
console.debug('WhoIs server could not be found!')
275+
log.debug('WhoIs server could not be found!')
275276
return {
276277
_raw: '',
277278
parsedData: null,
278279
}
279280
}
280-
console.debug(`WhoIs sever found for ${tld}: ${server}`)
281+
log.debug(`WhoIs sever found for ${tld}: ${server}`)
281282
}
282283

283284
server = serverData
@@ -287,9 +288,9 @@ export async function whois(
287288
const queryOptions = qOptions || ''
288289

289290
try {
290-
console.log(`Attempting WHOIS lookup for ${domain} on server ${server}`)
291+
log.debug(`Attempting WHOIS lookup for ${domain} on server ${server}`)
291292
const rawData = await tcpWhois(domain, queryOptions, server, port, encoding, proxy)
292-
console.log(`Raw WHOIS data received:`, rawData)
293+
log.debug(`Raw WHOIS data received:`, rawData)
293294
if (!parse) {
294295
const parsedData = WhoIsParser.parseData(rawData, null)
295296
return {
@@ -317,7 +318,8 @@ export async function whois(
317318
}
318319
}
319320
}
320-
catch (err) {
321+
catch (err: any) {
322+
log.debug(`Error in WHOIS lookup for ${domain} on server ${server}`, err)
321323
return {
322324
_raw: '',
323325
parsedData: null,
@@ -326,7 +328,7 @@ export async function whois(
326328
}
327329

328330
export function lookup(domain: string, options: WhoIsOptions | null = null): Promise<WhoIsResponse> {
329-
console.log(`Lookup called for ${domain}`)
331+
log.debug(`Lookup called for ${domain}`)
330332
return whois(domain, true, options)
331333
}
332334

storage/framework/core/whois/tests/whois.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('@stacksjs/whois', () => {
3333
it('should perform parsed whois lookup', async () => {
3434
try {
3535
const result = await lookup('example.com')
36-
console.log('Parsed WHOIS result:', result)
36+
// console.log('Parsed WHOIS result:', result)
3737
expect(result._raw).toContain('Domain Name: EXAMPLE.COM')
3838
expect(result.parsedData).toHaveProperty('Domain Name', 'EXAMPLE.COM')
3939
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import { testingThis } from '@stacksjs/desktop'
22

3+
// eslint-disable-next-line no-console
34
console.log(testingThis)

tests/feature/ui.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ import { expect, test } from 'bun:test'
33
test('dom test', () => {
44
document.body.innerHTML = `<button>My button</button>`
55
const button = document.querySelector('button')
6-
expect(button?.innerText).toEqual('My button')
6+
expect(button?.textContent).toEqual('My button')
77
})

0 commit comments

Comments
 (0)