A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/nodejs/node/commit/edd80e2bdc below:

do not throw on mocked clearTimeout() · nodejs/node@edd80e2 · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+24

-1

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+24

-1

lines changed Original file line number Diff line number Diff line change

@@ -304,7 +304,7 @@ class MockTimers {

304 304

}

305 305 306 306

#clearTimer(timer) {

307 -

if (timer.priorityQueuePosition !== undefined) {

307 +

if (timer?.priorityQueuePosition !== undefined) {

308 308

this.#executionQueue.removeAt(timer.priorityQueuePosition);

309 309

timer.priorityQueuePosition = undefined;

310 310

}

Original file line number Diff line number Diff line change

@@ -257,6 +257,13 @@ describe('Mock Timers Test Suite', () => {

257 257 258 258

assert.strictEqual(fn.mock.callCount(), 0);

259 259

});

260 + 261 +

it('clearTimeout does not throw on null and undefined', (t) => {

262 +

t.mock.timers.enable({ apis: ['setTimeout'] });

263 + 264 +

nodeTimers.clearTimeout();

265 +

nodeTimers.clearTimeout(null);

266 +

});

260 267

});

261 268 262 269

describe('setInterval Suite', () => {

@@ -305,6 +312,13 @@ describe('Mock Timers Test Suite', () => {

305 312 306 313

assert.strictEqual(fn.mock.callCount(), 0);

307 314

});

315 + 316 +

it('clearInterval does not throw on null and undefined', (t) => {

317 +

t.mock.timers.enable({ apis: ['setInterval'] });

318 + 319 +

nodeTimers.clearInterval();

320 +

nodeTimers.clearInterval(null);

321 +

});

308 322

});

309 323 310 324

describe('setImmediate Suite', () => {

@@ -372,6 +386,15 @@ describe('Mock Timers Test Suite', () => {

372 386

});

373 387

});

374 388 389 +

describe('clearImmediate Suite', () => {

390 +

it('clearImmediate does not throw on null and undefined', (t) => {

391 +

t.mock.timers.enable({ apis: ['setImmediate'] });

392 + 393 +

nodeTimers.clearImmediate();

394 +

nodeTimers.clearImmediate(null);

395 +

});

396 +

});

397 + 375 398

describe('timers/promises', () => {

376 399

describe('setTimeout Suite', () => {

377 400

it('should advance in time and trigger timers when calling the .tick function multiple times', async (t) => {

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4