MCPcopy Index your code
hub / github.com/nodejs/node / validateResult

Function validateResult

test/parallel/test-dns-resolvesrv.js:66–86  ·  view source on GitHub ↗
(result)

Source from the content-addressed store, hash-verified

64 resolverPromises.setServers([`127.0.0.1:${address.port}`]);
65
66 function validateResult(result) {
67 assert.ok(Array.isArray(result), 'Result should be an array');
68 assert.strictEqual(result.length, 3);
69
70 for (const record of result) {
71 assert.strictEqual(typeof record, 'object');
72 assert.strictEqual(typeof record.name, 'string');
73 assert.strictEqual(typeof record.port, 'number');
74 assert.strictEqual(typeof record.priority, 'number');
75 assert.strictEqual(typeof record.weight, 'number');
76 assert.strictEqual(record.port, 27017);
77 }
78
79 // Verify we got all expected server names
80 const names = result.map((r) => r.name).sort();
81 assert.deepStrictEqual(names, [
82 'server1.example.org',
83 'server2.example.org',
84 'server3.example.org',
85 ]);
86 }
87
88 // Test promises API
89 const promiseResult = await resolverPromises.resolveSrv(

Callers 1

Calls 3

sortMethod · 0.80
mapMethod · 0.65
okMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…