Socket
Socket
Sign inDemoInstall

fetch-mock

Package Overview
Dependencies
Maintainers
1
Versions
226
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-mock - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

2

es5/fetch-mock.js

@@ -137,3 +137,3 @@ 'use strict';

this.mockedContext = theGlobal;
this.realFetch = theGlobal.fetch;
this.realFetch = theGlobal.fetch && theGlobal.fetch.bind(theGlobal);
}

@@ -140,0 +140,0 @@

{
"name": "fetch-mock",
"version": "3.0.1",
"version": "3.0.2",
"description": "Mock http requests made using fetch (or isomorphic-fetch)",

@@ -5,0 +5,0 @@ "main": "src/server.js",

@@ -123,3 +123,3 @@ 'use strict';

this.mockedContext = theGlobal;
this.realFetch = theGlobal.fetch;
this.realFetch = theGlobal.fetch && theGlobal.fetch.bind(theGlobal);
}

@@ -126,0 +126,0 @@

@@ -6,3 +6,16 @@ 'use strict';

var fetchMock = require('../src/client.js');
var expect = require('chai').expect;
require('./spec')(fetchMock, window);
describe('native fetch behaviour', function () {
it('should not throw when passing unmatched calls through to native fetch', function () {
fetchMock.mock();
expect(function () {
fetch('http://www.example.com');
}).not.to.throw();
fetchMock.restore();
});
})
require('./spec')(fetchMock, window);
'use strict';
var expect = require('chai').expect;
var err = function (err) {
console.log(error);
}
module.exports = function (fetchMock, theGlobal) {
var fetchCalls = [];
var expect = require('chai').expect;
describe('fetch-mock', function () {
// we can't use sinon to spy on fetch in these tests as fetch-mock
// uses it internally and sinon doesn't allow spying on a previously
// stubbed function, so just use this very basic stub
var dummyFetch = theGlobal.fetch = fetchMock.realFetch = function () {
fetchCalls.push([].slice.call(arguments));
return Promise.resolve(arguments);
};
var fetchCalls = [];
var dummyFetch = function () {
fetchCalls.push([].slice.call(arguments));
return Promise.resolve(arguments);
};
before(function () {
theGlobal.fetch = fetchMock.realFetch = dummyFetch;
})
var err = function (err) {
console.log(error);
}
describe('fetch-mock', function () {
afterEach(function () {

@@ -24,0 +21,0 @@ fetchCalls = [];

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc