fix(tests): Update dev dependencies and refactor test assertions for improved clarity

This commit is contained in:
2025-05-19 09:15:42 +00:00
parent 771bfe94e7
commit 7c88ecd82a
8 changed files with 656 additions and 1656 deletions

View File

@ -1,4 +1,4 @@
import { tap, expect, expectAsync } from '@push.rocks/tapbundle';
import { tap, expect } from '@git.zone/tstest/tapbundle';
import { SmartNetwork, NetworkError } from '../ts/index.js';
import * as net from 'net';
import type { AddressInfo } from 'net';
@ -61,7 +61,7 @@ tap.test('traceroute fallback stub returns a single-hop stub', async () => {
const sn = new SmartNetwork();
const hops = await sn.traceroute('example.com', { maxHops: 5 });
expect(Array.isArray(hops)).toBeTrue();
expect(hops).toHaveLength(1);
expect(hops).array.toHaveLength(1);
expect(hops[0]).toEqual({ ttl: 1, ip: 'example.com', rtt: null });
});
@ -166,7 +166,7 @@ tap.test('isLocalPortUnused should detect used local port', async () => {
// port is now in use
const inUse = await sn.isLocalPortUnused(addr.port);
expect(inUse).toBeFalse();
await new Promise<void>((res) => server.close(res));
await new Promise<void>((resolve) => server.close(() => resolve()));
});
// Real traceroute integration test (skipped if `traceroute` binary is unavailable)
tap.test('traceroute real integration against google.com', async () => {