mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-30 01:47:21 +08:00
Made function argument to mockImplementation optional (#27599)
This commit is contained in:
2
types/jest/index.d.ts
vendored
2
types/jest/index.d.ts
vendored
@@ -775,7 +775,7 @@ declare namespace jest {
|
||||
*
|
||||
* Note: `jest.fn(implementation)` is a shorthand for `jest.fn().mockImplementation(implementation)`.
|
||||
*/
|
||||
mockImplementation(fn: (...args: any[]) => any): Mock<T>;
|
||||
mockImplementation(fn?: (...args: any[]) => any): Mock<T>;
|
||||
/**
|
||||
* Accepts a function that will be used as an implementation of the mock for one call to the mocked function.
|
||||
* Can be chained so that multiple function calls produce different results.
|
||||
|
||||
@@ -298,6 +298,7 @@ spy2.mockReset();
|
||||
|
||||
const spy3Mock: jest.Mock<() => string> = spy3
|
||||
.mockImplementation(() => "")
|
||||
.mockImplementation()
|
||||
.mockImplementation((arg: {}) => arg)
|
||||
.mockImplementation((...args: string[]) => args.join(""))
|
||||
.mockImplementationOnce(() => "")
|
||||
|
||||
Reference in New Issue
Block a user