Rename mock to stub.

This commit is contained in:
John-David Dalton
2016-05-12 07:53:28 -07:00
parent 4a19913726
commit a95cf1c26c
2 changed files with 348 additions and 348 deletions

216
lodash.js
View File

@@ -1232,10 +1232,10 @@
* lodash.isFunction(lodash.bar); * lodash.isFunction(lodash.bar);
* // => true * // => true
* *
* // Use `context` to mock `Date#getTime` use in `_.now`. * // Use `context` to stub `Date#getTime` use in `_.now`.
* var mock = _.runInContext({ * var stubbed = _.runInContext({
* 'Date': function() { * 'Date': function() {
* return { 'getTime': getTimeMock }; * return { 'getTime': stubGetTime };
* } * }
* }); * });
* *
@@ -1425,16 +1425,16 @@
* `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
* `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
* `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
* `min`, `minBy`, `mockArray`, `mockFalse`, `mockObject`, `mockString`, * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
* `mockTrue`, multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, `padEnd`, * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
* `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `repeat`, * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
* `result`, `round`, `runInContext`, `sample`, `shift`, `size`, `snakeCase`, * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
* `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
* `startCase`, `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
* `toFinite`, `toInteger`, `toJSON`, `toLength`, `toLower`, `toNumber`, * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
* `toSafeInteger`, `toString`, `toUpper`, `trim`, `trimEnd`, `trimStart`, * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
* `truncate`, `unescape`, `uniqueId`, `upperCase`, `upperFirst`, `value`, * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
* and `words` * `upperFirst`, `value`, and `words`
* *
* @name _ * @name _
* @constructor * @constructor
@@ -5422,7 +5422,7 @@
// Fallback for IE < 11. // Fallback for IE < 11.
if (!getOwnPropertySymbols) { if (!getOwnPropertySymbols) {
getSymbols = mockArray; getSymbols = stubArray;
} }
/** /**
@@ -14959,95 +14959,6 @@
return object; return object;
} }
/**
* A method that returns a new empty array.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {Array} Returns the new empty array.
* @example
*
* var arrays = _.times(2, _.mockArray);
*
* console.log(arrays);
* // => [[], []]
*
* console.log(arrays[0] === arrays[1]);
* // => false
*/
function mockArray() {
return [];
}
/**
* A method that returns `false`.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {boolean} Returns `false`.
* @example
*
* _.times(2 _.mockFalse);
* // => [false, false]
*/
var mockFalse = constant(false);
/**
* A method that returns a new empty object.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {Object} Returns the new empty object.
* @example
*
* var objects = _.times(2, _.mockObject);
*
* console.log(objects);
* // => [{}, {}]
*
* console.log(objects[0] === objects[1]);
* // => false
*/
function mockObject() {
return {};
}
/**
* A method that returns an empty string.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {string} Returns the empty string.
* @example
*
* _.times(2, _.mockString);
* // => ['', '']
*/
var mockString = constant('');
/**
* A method that returns `true`.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {boolean} Returns `true`.
* @example
*
* _.times(2, _.mockTrue);
* // => [true, true]
*/
var mockTrue = constant(true);
/** /**
* Reverts the `_` variable to its previous value and returns a reference to * Reverts the `_` variable to its previous value and returns a reference to
* the `lodash` function. * the `lodash` function.
@@ -15317,6 +15228,95 @@
*/ */
var rangeRight = createRange(true); var rangeRight = createRange(true);
/**
* A method that returns a new empty array.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {Array} Returns the new empty array.
* @example
*
* var arrays = _.times(2, _.stubArray);
*
* console.log(arrays);
* // => [[], []]
*
* console.log(arrays[0] === arrays[1]);
* // => false
*/
function stubArray() {
return [];
}
/**
* A method that returns `false`.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {boolean} Returns `false`.
* @example
*
* _.times(2 _.stubFalse);
* // => [false, false]
*/
var stubFalse = constant(false);
/**
* A method that returns a new empty object.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {Object} Returns the new empty object.
* @example
*
* var objects = _.times(2, _.stubObject);
*
* console.log(objects);
* // => [{}, {}]
*
* console.log(objects[0] === objects[1]);
* // => false
*/
function stubObject() {
return {};
}
/**
* A method that returns an empty string.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {string} Returns the empty string.
* @example
*
* _.times(2, _.stubString);
* // => ['', '']
*/
var stubString = constant('');
/**
* A method that returns `true`.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {boolean} Returns `true`.
* @example
*
* _.times(2, _.stubTrue);
* // => [true, true]
*/
var stubTrue = constant(true);
/** /**
* Invokes the iteratee `n` times, returning an array of the results of * Invokes the iteratee `n` times, returning an array of the results of
* each invocation. The iteratee is invoked with one argument; (index). * each invocation. The iteratee is invoked with one argument; (index).
@@ -16008,11 +16008,11 @@
lodash.meanBy = meanBy; lodash.meanBy = meanBy;
lodash.min = min; lodash.min = min;
lodash.minBy = minBy; lodash.minBy = minBy;
lodash.mockArray = mockArray; lodash.stubArray = stubArray;
lodash.mockFalse = mockFalse; lodash.stubFalse = stubFalse;
lodash.mockObject = mockObject; lodash.stubObject = stubObject;
lodash.mockTrue = mockTrue; lodash.stubString = stubString;
lodash.mockString = mockString; lodash.stubTrue = stubTrue;
lodash.multiply = multiply; lodash.multiply = multiply;
lodash.nth = nth; lodash.nth = nth;
lodash.noConflict = noConflict; lodash.noConflict = noConflict;

File diff suppressed because it is too large Load Diff