test: relax check in verify-graph

Relax the check regarding presence of async resources in graph to
allow extra events. Before this change events not mentioned in
reference graph were allowed but that one specified must match
exactly in count. Now it's allowed to have more events of this
type.

Refs: https://github.com/nodejs/node/pull/27477
Fixes: https://github.com/nodejs/node/issues/27617

PR-URL: https://github.com/nodejs/node/pull/27742
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
Gerhard Stoebich authored and Michaël Zasso committed 2019-05-20 13:20:17 +02:00
1 parent cf516f7b6a
commit f872210ffd
1 file changed
+4 -4
+4 -4
View File
@@ -99,7 +99,7 @@ module.exports = function verifyGraph(hooks, graph) {
}
assert.strictEqual(errors.length, 0);
// Verify that all expected types are present
// Verify that all expected types are present (but more/others are allowed)
const expTypes = Object.create(null);
for (let i = 0; i < graph.length; i++) {
if (expTypes[graph[i].type] == null) expTypes[graph[i].type] = 0;
@@ -107,9 +107,9 @@ module.exports = function verifyGraph(hooks, graph) {
}
for (const type in expTypes) {
assert.strictEqual(typeSeen[type], expTypes[type],
`Type '${type}': expecting: ${expTypes[type]} ` +
`found ${typeSeen[type]}`);
assert.ok(typeSeen[type] >= expTypes[type],
`Type '${type}': expecting: ${expTypes[type]} ` +
`found: ${typeSeen[type]}`);
}
};