Skip to content

Commit

Permalink
Add options jsdoc properties
Browse files Browse the repository at this point in the history
  • Loading branch information
ocodista committed Sep 8, 2023
1 parent cae4aa5 commit 9193686
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/internal/test_runner/mock/mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class MockTracker {
#mocks = [];
#timers;

/**
/**.
* Returns the mock timers of this MockTracker instance.
* @returns {MockTimers} The mock timers instance.
*/
Expand All @@ -158,13 +158,13 @@ class MockTracker {
* @returns {ProxyConstructor} The mock function tracker.
*/
fn(
original = function () {},
original = function() {},
implementation = original,
options = kEmptyObject,
) {
if (original !== null && typeof original === 'object') {
options = original;
original = function () { };
original = function() {};
implementation = original;
} else if (implementation !== null && typeof implementation === 'object') {
options = implementation;
Expand Down Expand Up @@ -272,11 +272,14 @@ class MockTracker {
}

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

/**
* Mocks a setter method of an object.
* Mocks a setter method of an object. This function is a syntax sugar for MockTracker.method with options.setter set to true.
* @param {Object} object - The target object.
* @param {string} methodName - The setter method to be mocked.
* @param {function} [implementation] - An optional replacement function for the targeted method.
* @param {Object} [options] - Additional tracking options.
* @param {boolean} [options.getter=false] - Indicates whether this is a getter method.
* @param {boolean} [options.setter=true] - Indicates whether this is a setter method.
* @param {number} [options.times=Infinity] - The maximum number of times the mock method can be called.
* @returns {ProxyConstructor} The mock method tracker.
*/
setter(
Expand Down

0 comments on commit 9193686

Please sign in to comment.