Skip to content

Commit 9193686

Browse files
committed
Add options jsdoc properties
1 parent cae4aa5 commit 9193686

File tree

1 file changed

+11
-5
lines changed
  • lib/internal/test_runner/mock

1 file changed

+11
-5
lines changed

lib/internal/test_runner/mock/mock.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class MockTracker {
140140
#mocks = [];
141141
#timers;
142142

143-
/**
143+
/**.
144144
* Returns the mock timers of this MockTracker instance.
145145
* @returns {MockTimers} The mock timers instance.
146146
*/
@@ -158,13 +158,13 @@ class MockTracker {
158158
* @returns {ProxyConstructor} The mock function tracker.
159159
*/
160160
fn(
161-
original = function () {},
161+
original = function() {},
162162
implementation = original,
163163
options = kEmptyObject,
164164
) {
165165
if (original !== null && typeof original === 'object') {
166166
options = original;
167-
original = function () { };
167+
original = function() {};
168168
implementation = original;
169169
} else if (implementation !== null && typeof implementation === 'object') {
170170
options = implementation;
@@ -272,11 +272,14 @@ class MockTracker {
272272
}
273273

274274
/**
275-
* Mocks a getter method of an object.
275+
* Mocks a getter method of an object. This is a syntax sugar for the MockTracker.method with options.getter set to true
276276
* @param {Object} object - The target object.
277277
* @param {string} methodName - The name of the getter method to be mocked.
278278
* @param {function} [implementation] - An optional replacement function for the targeted method.
279279
* @param {Object} [options] - Additional tracking options.
280+
* @param {boolean} [options.getter=true] - Indicates whether this is a getter method.
281+
* @param {boolean} [options.setter=false] - Indicates whether this is a setter method.
282+
* @param {number} [options.times=Infinity] - The maximum number of times the mock method can be called.
280283
* @returns {ProxyConstructor} The mock method tracker.
281284
*/
282285
getter(
@@ -308,11 +311,14 @@ class MockTracker {
308311
}
309312

310313
/**
311-
* Mocks a setter method of an object.
314+
* Mocks a setter method of an object. This function is a syntax sugar for MockTracker.method with options.setter set to true.
312315
* @param {Object} object - The target object.
313316
* @param {string} methodName - The setter method to be mocked.
314317
* @param {function} [implementation] - An optional replacement function for the targeted method.
315318
* @param {Object} [options] - Additional tracking options.
319+
* @param {boolean} [options.getter=false] - Indicates whether this is a getter method.
320+
* @param {boolean} [options.setter=true] - Indicates whether this is a setter method.
321+
* @param {number} [options.times=Infinity] - The maximum number of times the mock method can be called.
316322
* @returns {ProxyConstructor} The mock method tracker.
317323
*/
318324
setter(

0 commit comments

Comments
 (0)