From 3735f0bf8c8bcec519db3c496914e1091836b92f Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Wed, 15 Apr 2020 13:01:02 -0300 Subject: [PATCH] Replace `fetch-mock` with stub (#8339) The `fetch-mock` package has been removed, and replaced with a simple stub in the one place it was used. --- package.json | 1 - test/unit/ui/app/actions.spec.js | 8 +++++--- yarn.lock | 35 +------------------------------- 3 files changed, 6 insertions(+), 38 deletions(-) diff --git a/package.json b/package.json index 905f9ef3b..bb240b376 100644 --- a/package.json +++ b/package.json @@ -222,7 +222,6 @@ "eslint-plugin-react": "^7.18.3", "fancy-log": "^1.3.3", "fast-glob": "^3.2.2", - "fetch-mock": "^6.5.2", "file-loader": "^1.1.11", "fs-extra": "^8.1.0", "ganache-cli": "^6.4.4", diff --git a/test/unit/ui/app/actions.spec.js b/test/unit/ui/app/actions.spec.js index 6e00d3d52..588f83957 100644 --- a/test/unit/ui/app/actions.spec.js +++ b/test/unit/ui/app/actions.spec.js @@ -1,7 +1,6 @@ import assert from 'assert' import sinon from 'sinon' import { cloneDeep } from 'lodash' -import fetchMock from 'fetch-mock' import configureStore from 'redux-mock-store' import thunk from 'redux-thunk' import EthQuery from 'eth-query' @@ -1433,12 +1432,15 @@ describe('Actions', function () { let setCurrentLocaleSpy beforeEach(function () { - fetchMock.get('*', enLocale) + sinon.stub(global, 'fetch') + .resolves({ + json: async () => enLocale, + }) }) afterEach(function () { setCurrentLocaleSpy.restore() - fetchMock.restore() + global.fetch.restore() }) it('calls expected actions', async function () { diff --git a/yarn.lock b/yarn.lock index df783ee52..08d5ce233 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5055,15 +5055,6 @@ babel-plugin-transform-undefined-to-void@^6.9.4: resolved "https://registry.yarnpkg.com/babel-plugin-transform-undefined-to-void/-/babel-plugin-transform-undefined-to-void-6.9.4.tgz#be241ca81404030678b748717322b89d0c8fe280" integrity sha1-viQcqBQEAwZ4t0hxcyK4nQyP4oA= -babel-polyfill@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.26.0.tgz#379937abc67d7895970adc621f284cd966cf2153" - integrity sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM= - dependencies: - babel-runtime "^6.26.0" - core-js "^2.5.0" - regenerator-runtime "^0.10.5" - babel-preset-env@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/babel-preset-env/-/babel-preset-env-1.7.0.tgz#dea79fa4ebeb883cd35dab07e260c1c9c04df77a" @@ -10486,7 +10477,7 @@ eth-method-registry@^1.2.0: dependencies: ethjs "^0.3.0" -eth-phishing-detect@^1.1.4, eth-phishing-detect@^1.1.13: +eth-phishing-detect@^1.1.13, eth-phishing-detect@^1.1.4: version "1.1.13" resolved "https://registry.yarnpkg.com/eth-phishing-detect/-/eth-phishing-detect-1.1.13.tgz#ed718b933c8a69fef0cefa6604538824b472dbea" integrity sha512-1KQcKvAQIjJgFMVwxaw2+BlzM9Momzl0e+/torPdMjg7WGq6LmCIS7ddg84diH5zIQp9quGyRVIEawCCuErgVQ== @@ -11662,15 +11653,6 @@ fd-slicer@~1.1.0: dependencies: pend "~1.2.0" -fetch-mock@^6.5.2: - version "6.5.2" - resolved "https://registry.yarnpkg.com/fetch-mock/-/fetch-mock-6.5.2.tgz#b3842b305c13ea0f81c85919cfaa7de387adfa3e" - integrity sha512-EIvbpCLBTYyDLu4HJiqD7wC8psDwTUaPaWXNKZbhNO/peUYKiNp5PkZGKRJtnTxaPQu71ivqafvjpM7aL+MofQ== - dependencies: - babel-polyfill "^6.26.0" - glob-to-regexp "^0.4.0" - path-to-regexp "^2.2.1" - fetch-ponyfill@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/fetch-ponyfill/-/fetch-ponyfill-4.1.0.tgz#ae3ce5f732c645eab87e4ae8793414709b239893" @@ -12816,11 +12798,6 @@ glob-to-regexp@^0.3.0: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs= -glob-to-regexp@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.0.tgz#49bd677b1671022bd10921c3788f23cdebf9c7e6" - integrity sha512-fyPCII4vn9Gvjq2U/oDAfP433aiE64cyP/CJjRJcpVGjqqNdioUYn9+r0cSzT1XPwmGAHuTT7iv+rQT8u/YHKQ== - glob-watcher@^5.0.3: version "5.0.3" resolved "https://registry.yarnpkg.com/glob-watcher/-/glob-watcher-5.0.3.tgz#88a8abf1c4d131eb93928994bc4a593c2e5dd626" @@ -21488,11 +21465,6 @@ path-to-regexp@^1.7.0: dependencies: isarray "0.0.1" -path-to-regexp@^2.2.1: - version "2.4.0" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-2.4.0.tgz#35ce7f333d5616f1c1e1bfe266c3aba2e5b2e704" - integrity sha512-G6zHoVqC6GGTQkZwF4lkuEyMbVOjoBKAEybQUypI1WTkqinCOrq2x6U2+phkJ1XsEMTy4LjtwPI7HW+NVrRR2w== - path-type@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" @@ -23886,11 +23858,6 @@ regenerator-runtime@0.13.3, regenerator-runtime@^0.13.3: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz#7cf6a77d8f5c6f60eb73c5fc1955b2ceb01e6bf5" integrity sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw== -regenerator-runtime@^0.10.5: - version "0.10.5" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658" - integrity sha1-M2w+/BIgrc7dosn6tntaeVWjNlg= - regenerator-runtime@^0.11.0, regenerator-runtime@^0.11.1: version "0.11.1" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"