Skip to content

Integrate fetch-mock into describes.js#11001

Merged
dreamofabear merged 8 commits intoampproject:masterfrom
dreamofabear:fetch-mock
Aug 21, 2017
Merged

Integrate fetch-mock into describes.js#11001
dreamofabear merged 8 commits intoampproject:masterfrom
dreamofabear:fetch-mock

Conversation

@dreamofabear
Copy link
Copy Markdown

@dreamofabear dreamofabear commented Aug 18, 2017

Fixes #10477. Forked from #10776.

describes.realWin('fetch-mock', {}, env => {
  it('should mock fetches', function() {
    const mock = env.expectFetch('fake.com');

    return env.win.fetch('fake.com').then(response => {
      expect(mock.called('fake.com')).to.be.true;
    });
  });
});

See test-describes.js and this documentation for example usage and details. To disable, add fetchMock: false to spec object.

package.json Outdated
"eslint": "3.18.0",
"eslint-plugin-google-camelcase": "0.0.2",
"express": "4.14.0",
"fetch-mock": "^5.12.2",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove ^

@dreamofabear dreamofabear merged commit 64ca20d into ampproject:master Aug 21, 2017
@dreamofabear dreamofabear deleted the fetch-mock branch August 21, 2017 21:08
@cvializ
Copy link
Copy Markdown
Contributor

cvializ commented Aug 23, 2017

OOO when reviewed, but LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants