Skip to content

Commit

Permalink
fixed broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wheresrhys committed Apr 15, 2020
1 parent b1f33ec commit 3cdc7ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ FetchMock.sandbox = function() {
// this construct allows us to create a fetch-mock instance which is also
// a callable function, while circumventing circularity when defining the
// object that this function should be bound to
const proxy = (url, options) => sandbox.fetchHandler(url, options);
const fetchMockProxy = (url, options) => sandbox.fetchHandler(url, options);

const sandbox = Object.assign(
proxy, // Ensures that the entire returned object is a callable function
fetchMockProxy, // Ensures that the entire returned object is a callable function
FetchMock, // prototype methods
this.createInstance(), // instance data
{
Expand Down
6 changes: 4 additions & 2 deletions test/specs/sandbox.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,11 @@ module.exports = (fetchMock, theGlobal) => {
Response
} = fetchMock.sandbox();

expect(fetch.name).to.equal('proxy');
expect(fetch.name).to.equal('fetchMockProxy');
expect(new Headers()).to.be.an.instanceOf(fetchMock.config.Headers);
expect(new Request()).to.be.an.instanceOf(fetchMock.config.Request);
expect(new Request('http://example.com')).to.be.an.instanceOf(
fetchMock.config.Request
);
expect(new Response()).to.be.an.instanceOf(fetchMock.config.Response);
});
});
Expand Down

0 comments on commit 3cdc7ba

Please sign in to comment.