mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Merge pull request #18655 from chrissinclair/master
[fetch-mock] Added missing flush() method to FetchMockStatic
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import * as fetchMock from "fetch-mock";
|
||||
import { MockResponse } from "fetch-mock";
|
||||
|
||||
fetchMock.mock("http://test.com", 200);
|
||||
fetchMock.mock(/test\.com/, 200);
|
||||
@@ -65,3 +66,6 @@ const myMatcher: fetchMock.MockMatcherFunction = (
|
||||
url: string,
|
||||
opts: fetchMock.MockRequest
|
||||
) => true;
|
||||
|
||||
fetchMock.flush().then(resolved => resolved.forEach(console.log));
|
||||
fetchMock.flush().catch(r => r);
|
||||
|
||||
Vendored
+11
-2
@@ -1,6 +1,9 @@
|
||||
// Type definitions for fetch-mock 5.8
|
||||
// Type definitions for fetch-mock 5.12
|
||||
// Project: https://github.com/wheresrhys/fetch-mock
|
||||
// Definitions by: Alexey Svetliakov <https://github.com/asvetliakov>, Tamir Duberstein <https://github.com/tamird>, Risto Keravuori <https://github.com/merrywhether>
|
||||
// Definitions by: Alexey Svetliakov <https://github.com/asvetliakov>
|
||||
// Tamir Duberstein <https://github.com/tamird>
|
||||
// Risto Keravuori <https://github.com/merrywhether>
|
||||
// Chris Sinclair <https://github.com/chrissinclair>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@@ -333,6 +336,12 @@ declare namespace fetchMock {
|
||||
*/
|
||||
reset(): this;
|
||||
|
||||
/**
|
||||
* Returns a promise that resolves once all fetches handled by fetch-mock
|
||||
* have resolved.
|
||||
*/
|
||||
flush(): Promise<MockResponse[]>;
|
||||
|
||||
/**
|
||||
* Returns all calls to fetch, grouped by whether fetch-mock matched
|
||||
* them or not.
|
||||
|
||||
Reference in New Issue
Block a user