test: validate ERR_INVALID_THIS for scheduler methods

Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/63764
Refs: https://app.codecov.io/gh/nodejs/node/blob/main/lib%2Ftimers%2Fpromises.js
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit is contained in:
Daijiro Wachi authored and GitHub committed 2026-06-09 14:21:21 +00:00
1 parent 5e645ccf55
commit 1be74647ca
1 file changed
+14
@@ -49,3 +49,17 @@ testCancelableWait2().then(common.mustCall());
assert.throws(() => new scheduler.constructor(), {
code: 'ERR_ILLEGAL_CONSTRUCTOR',
});
assert.throws(() => {
scheduler.yield.call({});
}, {
code: 'ERR_INVALID_THIS',
message: /Scheduler/,
});
assert.throws(() => {
scheduler.wait.call({}, 10);
}, {
code: 'ERR_INVALID_THIS',
message: /Scheduler/,
});