MCPcopy Create free account
hub / github.com/ampproject/amphtml / attachFetchMock

Function attachFetchMock

testing/describes.js:283–289  ·  view source on GitHub ↗

* Mocks Window.fetch in the given environment and exposes `env.fetchMock`. For * convenience, also exposes fetch-mock's mock() function as * `env.expectFetch(matcher, response)`. * * @param {!Object} env * @see http://www.wheresrhys.co.uk/fetch-mock/quickstart

(env)

Source from the content-addressed store, hash-verified

281 * @see http://www.wheresrhys.co.uk/fetch-mock/quickstart
282 */
283function attachFetchMock(env) {
284 fetchMock.global = env.win;
285 fetchMock._mock();
286
287 env.fetchMock = fetchMock;
288 env.expectFetch = fetchMock.mock.bind(fetchMock);
289}
290
291/**
292 * Returns a wrapped version of Mocha's describe(), it() and only() methods

Callers 2

setupMethod · 0.85
setupMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected