test: fix internet/test-dns

The `nodejs.org` domain has now two TXT records.
Do not verify the exact number of records returned (only their shape),
and check that one of them is the SPF.

PR-URL: https://github.com/nodejs/node/pull/59660
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
This commit is contained in:
Michaël Zasso
2025-08-30 11:47:38 +02:00
committed by GitHub
parent 5af035503a
commit 67cb0adbc2

View File

@@ -523,9 +523,9 @@ TEST(function test_resolveTlsa_failure(done) {
TEST(async function test_resolveTxt(done) {
function validateResult(result) {
assert.ok(Array.isArray(result[0]));
assert.strictEqual(result.length, 1);
assert(result[0][0].startsWith('v=spf1'));
assert.ok(result.length > 0);
assert.ok(result.every((elem) => Array.isArray(elem) && elem.length === 1));
assert.ok(result.some((elem) => elem[0].startsWith('v=spf1')));
}
validateResult(await dnsPromises.resolveTxt(addresses.TXT_HOST));