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 Antoine du Hamel committed 2026-07-30 13:51:34 +02:00
1 parent d59d7fdd16
commit a17cf06d12
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/,
});