@samitouri / QOS-React-2 / commits / 8af991f10b

Codemod mockReturnValue externally

320024555cef1b826f8ba9e8bafccad8a5a118e7 didn't update the mocks module here, just the callsites.

Paul O’Shannessy committed May 8, 2014 at 10:47 UTC 8af991f10bbe45b532ee8ae4798f5288e624abc1
1 file changed +7 -7
src/test/mocks.js
+7 -7
@@ -96,7 +96,7 @@ function makeComponent(metadata) {
96
97 var returnValue;
98 // If return value is last set, either specific or default, i.e.
99 - // mockReturnValue()/mockDefaultReturnValue() is called and no
99 + // mockReturnValueOnce()/mockReturnValue() is called and no
100 // mockImplementation() is called after that.
101 // use the set return value.
102 if (isReturnValueLastSet) {
@@ -132,14 +132,14 @@ function makeComponent(metadata) {
132 instances.length = 0;
133 };
134
135 - f.mockReturnValue = function(value) {
135 + f.mockReturnValueOnce = function(value) {
136 // next function call will return this value or default return value
137 isReturnValueLastSet = true;
138 specificReturnValues.push(value);
139 return f;
140 };
141
142 - f.mockDefaultReturnValue = function(value) {
142 + f.mockReturnValue = function(value) {
143 // next function call will return specified return value or this one
144 isReturnValueLastSet = true;
145 defaultReturnValue = value;
@@ -403,11 +403,11 @@ module.exports = {
403 * each call to the function. This is useful for retrieving instances from a
404 * constructor.
405 *
406 - * .mockReturnValue(value)
406 + * .mockReturnValueOnce(value)
407 * Pushes the given value onto a FIFO queue of return values for the
408 * function.
409 *
410 - * .mockDefaultReturnValue(value)
410 + * .mockReturnValue(value)
411 * Sets the default return value for the function.
412 *
413 * .mockImplementation(function)
@@ -417,9 +417,9 @@ module.exports = {
417 * Syntactic sugar for .mockImplementation(function() {return this;})
418 *
419 * In case both mockImplementation() and
420 - * mockReturnValue()/mockDefaultReturnValue() are called. The priority of
420 + * mockReturnValueOnce()/mockReturnValue() are called. The priority of
421 * which to use is based on what is the last call:
422 - * - if the last call is mockRetrunValue() or mockDefaultReturnValue(),
422 + * - if the last call is mockReturnValueOnce() or mockReturnValue(),
423 * use the specific return specific return value or default return value.
424 * If specific return values are used up or no default return value is set,
425 * fall back to try mockImplementation();