Updating NPM dependencies
This commit is contained in:
32
node_modules/jest-jasmine2/build/jasmine/SpyStrategy.js
generated
vendored
32
node_modules/jest-jasmine2/build/jasmine/SpyStrategy.js
generated
vendored
@@ -50,11 +50,13 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* eslint-disable local/ban-types-eventually, local/prefer-rest-params-eventually */
|
||||
class SpyStrategy {
|
||||
constructor({
|
||||
name = 'unknown',
|
||||
fn = function() {},
|
||||
getSpy = function() {}
|
||||
fn = function () {},
|
||||
getSpy = function () {}
|
||||
} = {}) {
|
||||
_defineProperty(this, 'identity', void 0);
|
||||
|
||||
@@ -75,51 +77,51 @@ class SpyStrategy {
|
||||
const identity = name;
|
||||
const originalFn = fn;
|
||||
|
||||
let plan = function plan() {};
|
||||
let plan = function () {};
|
||||
|
||||
this.identity = function() {
|
||||
this.identity = function () {
|
||||
return identity;
|
||||
};
|
||||
|
||||
this.exec = function() {
|
||||
this.exec = function () {
|
||||
return plan.apply(this, arguments);
|
||||
};
|
||||
|
||||
this.callThrough = function() {
|
||||
this.callThrough = function () {
|
||||
plan = originalFn;
|
||||
return getSpy();
|
||||
};
|
||||
|
||||
this.returnValue = function(value) {
|
||||
plan = function plan() {
|
||||
this.returnValue = function (value) {
|
||||
plan = function () {
|
||||
return value;
|
||||
};
|
||||
|
||||
return getSpy();
|
||||
};
|
||||
|
||||
this.returnValues = function() {
|
||||
this.returnValues = function () {
|
||||
const values = Array.prototype.slice.call(arguments);
|
||||
|
||||
plan = function plan() {
|
||||
plan = function () {
|
||||
return values.shift();
|
||||
};
|
||||
|
||||
return getSpy();
|
||||
};
|
||||
|
||||
this.throwError = function(something) {
|
||||
this.throwError = function (something) {
|
||||
const error =
|
||||
something instanceof Error ? something : new Error(something);
|
||||
|
||||
plan = function plan() {
|
||||
plan = function () {
|
||||
throw error;
|
||||
};
|
||||
|
||||
return getSpy();
|
||||
};
|
||||
|
||||
this.callFake = function(fn) {
|
||||
this.callFake = function (fn) {
|
||||
if (typeof fn !== 'function') {
|
||||
throw new Error(
|
||||
'Argument passed to callFake should be a function, got ' + fn
|
||||
@@ -130,8 +132,8 @@ class SpyStrategy {
|
||||
return getSpy();
|
||||
};
|
||||
|
||||
this.stub = function(_fn) {
|
||||
plan = function plan() {};
|
||||
this.stub = function (_fn) {
|
||||
plan = function () {};
|
||||
|
||||
return getSpy();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user