Skip to content

Commit 070577e

Browse files
deokjinkimtargos
authored andcommitted
doc: fix wrong variable name in example of timers.tick()
Change variable name from `twoSeconds` to `threeSeconds` because actual value is 3000(ms). And add missing supported timer value(clearImmediate). Plus, fix typo(implicity -> implicitly). PR-URL: #53147 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Ulises Gascón <[email protected]>
1 parent 3bfce6c commit 070577e

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

doc/api/test.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -2226,10 +2226,10 @@ test('mocks setTimeout to be executed synchronously without having to actually w
22262226
const nineSecs = 9000;
22272227
setTimeout(fn, nineSecs);
22282228

2229-
const twoSeconds = 3000;
2230-
context.mock.timers.tick(twoSeconds);
2231-
context.mock.timers.tick(twoSeconds);
2232-
context.mock.timers.tick(twoSeconds);
2229+
const threeSeconds = 3000;
2230+
context.mock.timers.tick(threeSeconds);
2231+
context.mock.timers.tick(threeSeconds);
2232+
context.mock.timers.tick(threeSeconds);
22332233

22342234
assert.strictEqual(fn.mock.callCount(), 1);
22352235
});
@@ -2245,10 +2245,10 @@ test('mocks setTimeout to be executed synchronously without having to actually w
22452245
const nineSecs = 9000;
22462246
setTimeout(fn, nineSecs);
22472247

2248-
const twoSeconds = 3000;
2249-
context.mock.timers.tick(twoSeconds);
2250-
context.mock.timers.tick(twoSeconds);
2251-
context.mock.timers.tick(twoSeconds);
2248+
const threeSeconds = 3000;
2249+
context.mock.timers.tick(threeSeconds);
2250+
context.mock.timers.tick(threeSeconds);
2251+
context.mock.timers.tick(threeSeconds);
22522252

22532253
assert.strictEqual(fn.mock.callCount(), 1);
22542254
});
@@ -2298,8 +2298,8 @@ test('mocks setTimeout to be executed synchronously without having to actually w
22982298

22992299
#### Using clear functions
23002300

2301-
As mentioned, all clear functions from timers (`clearTimeout` and `clearInterval`)
2302-
are implicity mocked. Take a look at this example using `setTimeout`:
2301+
As mentioned, all clear functions from timers (`clearTimeout`, `clearInterval`,and
2302+
`clearImmediate`) are implicitly mocked. Take a look at this example using `setTimeout`:
23032303

23042304
```mjs
23052305
import assert from 'node:assert';
@@ -2312,7 +2312,7 @@ test('mocks setTimeout to be executed synchronously without having to actually w
23122312
context.mock.timers.enable({ apis: ['setTimeout'] });
23132313
const id = setTimeout(fn, 9999);
23142314

2315-
// Implicity mocked as well
2315+
// Implicitly mocked as well
23162316
clearTimeout(id);
23172317
context.mock.timers.tick(9999);
23182318

@@ -2332,7 +2332,7 @@ test('mocks setTimeout to be executed synchronously without having to actually w
23322332
context.mock.timers.enable({ apis: ['setTimeout'] });
23332333
const id = setTimeout(fn, 9999);
23342334

2335-
// Implicity mocked as well
2335+
// Implicitly mocked as well
23362336
clearTimeout(id);
23372337
context.mock.timers.tick(9999);
23382338

0 commit comments

Comments
 (0)