jest-mock
Advanced tools
Comparing version 21.3.0-alpha.eff7a1cf to 21.3.0-beta.2
@@ -37,2 +37,3 @@ 'use strict'; | ||
const MOCK_CONSTRUCTOR_NAME = 'mockConstructor'; /** | ||
@@ -273,2 +274,3 @@ * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
mockImpl: undefined, | ||
mockName: 'jest.fn()', | ||
specificMockImpls: [], | ||
@@ -331,5 +333,6 @@ specificReturnValues: [] }; | ||
// Run the mock constructor implementation | ||
return ( | ||
mockConfig.mockImpl && mockConfig.mockImpl.apply(this, arguments)); | ||
const mockImpl = mockConfig.specificMockImpls.length ? | ||
mockConfig.specificMockImpls.shift() : | ||
mockConfig.mockImpl; | ||
return mockImpl && mockImpl.apply(this, arguments); | ||
} | ||
@@ -439,2 +442,15 @@ | ||
f.mockName = name => { | ||
if (name) { | ||
const mockConfig = this._ensureMockConfig(f); | ||
mockConfig.mockName = name; | ||
} | ||
return f; | ||
}; | ||
f.getMockName = () => { | ||
const mockConfig = this._ensureMockConfig(f); | ||
return mockConfig.mockName || 'jest.fn()'; | ||
}; | ||
if (metadata.mockImpl) { | ||
@@ -441,0 +457,0 @@ f.mockImplementation(metadata.mockImpl); |
{ | ||
"name": "jest-mock", | ||
"version": "21.3.0-alpha.eff7a1cf", | ||
"version": "21.3.0-beta.2", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
89150
2430