MCPcopy
hub / github.com/ampproject/amphtml / runTests

Function runTests

test/unit/test-describes.js:4–18  ·  view source on GitHub ↗

@param {!Object} env

(env)

Source from the content-addressed store, hash-verified

2describes.sandboxed('fetch-mock', {}, () => {
3 /** @param {!Object} env */
4 function runTests(env) {
5 it('should mock fetches', () => {
6 const mock = env.expectFetch('fake.com', {payload: 'foo'});
7
8 return env.win
9 .fetch('fake.com')
10 .then((response) => {
11 return response.json();
12 })
13 .then((data) => {
14 expect(data.payload).to.equal('foo');
15 expect(mock.called('fake.com')).to.be.true;
16 });
17 });
18 }
19
20 describes.realWin('on realWin', {mockFetch: true}, (env) => {
21 runTests(env);

Callers 1

test-describes.jsFile · 0.85

Calls 6

expectFunction · 0.85
calledMethod · 0.80
itFunction · 0.50
thenMethod · 0.45
fetchMethod · 0.45
jsonMethod · 0.45

Tested by

no test coverage detected