mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-12 19:59:02 +08:00
jest: added restoreAllMocks
This commit is contained in:
6
types/jest/index.d.ts
vendored
6
types/jest/index.d.ts
vendored
@@ -60,6 +60,12 @@ declare namespace jest {
|
||||
* Equivalent to calling .mockClear() on every mocked function.
|
||||
*/
|
||||
function resetAllMocks(): typeof jest;
|
||||
/**
|
||||
* available in Jest 20.1.0+
|
||||
* Restores all mocks back to their original value. Equivalent to calling .mockRestore on every mocked function.
|
||||
* Beware that jest.restoreAllMocks() only works when mock was created with jest.spyOn; other mocks will require you to manually restore them.
|
||||
*/
|
||||
function restoreAllMocks(): typeof jest;
|
||||
/**
|
||||
* Removes any pending timers from the timer system. If any timers have
|
||||
* been scheduled, they will be cleared and will never have the opportunity
|
||||
|
||||
@@ -17,6 +17,12 @@ describe('sum', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('restoreAllMocks', () => {
|
||||
afterEach(() => {
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
});
|
||||
|
||||
describe('fetchCurrentUser', () => {
|
||||
it('calls the callback when $.ajax requests are finished', () => {
|
||||
const fetchCurrentUser = require('../fetchCurrentUser');
|
||||
|
||||
Reference in New Issue
Block a user