test: improve test coverage in perf_hooks

PR-URL: https://github.com/nodejs/node/pull/26290
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
Juan José Arboleda 2019-02-24 13:51:50 -05:00 committed by Ruben Bridgewater
parent 6f6f6d4087
commit 3826d692cc
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762

View File

@ -47,6 +47,14 @@ const obs = new PerformanceObserver(common.mustCall((items) => {
assert.fail('invalid entry name');
}
}, 4));
// Should throw if entryTypes are not valid
{
const expectedError = { code: 'ERR_VALID_PERFORMANCE_ENTRY_TYPE' };
const wrongEntryTypes = { entryTypes: ['foo', 'bar', 'baz'] };
assert.throws(() => obs.observe(wrongEntryTypes), expectedError);
}
obs.observe({ entryTypes: ['http2'] });
const body =