Skip to content

Commit 41b08bd

Browse files
deokjinkimmarco-ippolito
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 698ea7a commit 41b08bd

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
@@ -2098,10 +2098,10 @@ test('mocks setTimeout to be executed synchronously without having to actually w
20982098
const nineSecs = 9000;
20992099
setTimeout(fn, nineSecs);
21002100

2101-
const twoSeconds = 3000;
2102-
context.mock.timers.tick(twoSeconds);
2103-
context.mock.timers.tick(twoSeconds);
2104-
context.mock.timers.tick(twoSeconds);
2101+
const threeSeconds = 3000;
2102+
context.mock.timers.tick(threeSeconds);
2103+
context.mock.timers.tick(threeSeconds);
2104+
context.mock.timers.tick(threeSeconds);
21052105

21062106
assert.strictEqual(fn.mock.callCount(), 1);
21072107
});
@@ -2117,10 +2117,10 @@ test('mocks setTimeout to be executed synchronously without having to actually w
21172117
const nineSecs = 9000;
21182118
setTimeout(fn, nineSecs);
21192119

2120-
const twoSeconds = 3000;
2121-
context.mock.timers.tick(twoSeconds);
2122-
context.mock.timers.tick(twoSeconds);
2123-
context.mock.timers.tick(twoSeconds);
2120+
const threeSeconds = 3000;
2121+
context.mock.timers.tick(threeSeconds);
2122+
context.mock.timers.tick(threeSeconds);
2123+
context.mock.timers.tick(threeSeconds);
21242124

21252125
assert.strictEqual(fn.mock.callCount(), 1);
21262126
});
@@ -2170,8 +2170,8 @@ test('mocks setTimeout to be executed synchronously without having to actually w
21702170

21712171
#### Using clear functions
21722172

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

21762176
```mjs
21772177
import assert from 'node:assert';
@@ -2184,7 +2184,7 @@ test('mocks setTimeout to be executed synchronously without having to actually w
21842184
context.mock.timers.enable({ apis: ['setTimeout'] });
21852185
const id = setTimeout(fn, 9999);
21862186

2187-
// Implicity mocked as well
2187+
// Implicitly mocked as well
21882188
clearTimeout(id);
21892189
context.mock.timers.tick(9999);
21902190

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

2207-
// Implicity mocked as well
2207+
// Implicitly mocked as well
22082208
clearTimeout(id);
22092209
context.mock.timers.tick(9999);
22102210

0 commit comments

Comments
 (0)