Skip to content

Commit a7c6128

Browse files
deokjinkimbmeck
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: nodejs#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 e032f48 commit a7c6128

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

doc/api/test.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2234,10 +2234,10 @@ test('mocks setTimeout to be executed synchronously without having to actually w
22342234
const nineSecs = 9000;
22352235
setTimeout(fn, nineSecs);
22362236

2237-
const twoSeconds = 3000;
2238-
context.mock.timers.tick(twoSeconds);
2239-
context.mock.timers.tick(twoSeconds);
2240-
context.mock.timers.tick(twoSeconds);
2237+
const threeSeconds = 3000;
2238+
context.mock.timers.tick(threeSeconds);
2239+
context.mock.timers.tick(threeSeconds);
2240+
context.mock.timers.tick(threeSeconds);
22412241

22422242
assert.strictEqual(fn.mock.callCount(), 1);
22432243
});
@@ -2253,10 +2253,10 @@ test('mocks setTimeout to be executed synchronously without having to actually w
22532253
const nineSecs = 9000;
22542254
setTimeout(fn, nineSecs);
22552255

2256-
const twoSeconds = 3000;
2257-
context.mock.timers.tick(twoSeconds);
2258-
context.mock.timers.tick(twoSeconds);
2259-
context.mock.timers.tick(twoSeconds);
2256+
const threeSeconds = 3000;
2257+
context.mock.timers.tick(threeSeconds);
2258+
context.mock.timers.tick(threeSeconds);
2259+
context.mock.timers.tick(threeSeconds);
22602260

22612261
assert.strictEqual(fn.mock.callCount(), 1);
22622262
});
@@ -2306,8 +2306,8 @@ test('mocks setTimeout to be executed synchronously without having to actually w
23062306

23072307
#### Using clear functions
23082308

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

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

2323-
// Implicity mocked as well
2323+
// Implicitly mocked as well
23242324
clearTimeout(id);
23252325
context.mock.timers.tick(9999);
23262326

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

2343-
// Implicity mocked as well
2343+
// Implicitly mocked as well
23442344
clearTimeout(id);
23452345
context.mock.timers.tick(9999);
23462346

0 commit comments

Comments
 (0)