From 0d05f6374b6a535928a306a856375e88bc9f730c Mon Sep 17 00:00:00 2001 From: Nick Robinson Date: Fri, 21 Jan 2022 14:06:42 -0500 Subject: [PATCH 1/3] btoa is no longer included as an axios helper --- index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/index.js b/index.js index 29c8caf..ee0a612 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,6 @@ import axios from 'axios' import buildURL from 'axios/lib/helpers/buildURL' import isURLSameOrigin from 'axios/lib/helpers/isURLSameOrigin' -import btoa from 'axios/lib/helpers/btoa' import cookies from 'axios/lib/helpers/cookies' import settle from 'axios/lib/core/settle' import createError from 'axios/lib/core/createError' From a2bf5f7a29165352233987777027c36eb9d8579f Mon Sep 17 00:00:00 2001 From: Nick Robinson Date: Fri, 21 Jan 2022 14:07:13 -0500 Subject: [PATCH 2/3] update to axios 0.25.0 --- package-lock.json | 26 ++++++++------------------ package.json | 4 ++-- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2769093..3b3a80f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -234,12 +234,12 @@ } }, "axios": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.13.1.tgz", - "integrity": "sha1-Pmer/kMzvJ0tX+b70TtGlOr8jfg=", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.25.0.tgz", + "integrity": "sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==", "dev": true, "requires": { - "follow-redirects": "0.0.7" + "follow-redirects": "^1.14.7" } }, "babel-cli": { @@ -2197,14 +2197,10 @@ } }, "follow-redirects": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-0.0.7.tgz", - "integrity": "sha1-NLkLqyqRGqNHVx2pDyK9NuzYqRk=", - "dev": true, - "requires": { - "debug": "^2.2.0", - "stream-consume": "^0.1.0" - } + "version": "1.14.7", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz", + "integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==", + "dev": true }, "for-in": { "version": "1.0.2", @@ -5949,12 +5945,6 @@ "readable-stream": "^2.0.2" } }, - "stream-consume": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/stream-consume/-/stream-consume-0.1.1.tgz", - "integrity": "sha512-tNa3hzgkjEP7XbCkbRXe1jpg+ievoa0O4SCFlMOYEscGSS4JJsckGL8swUyAa/ApGU3Ae4t6Honor4HhL+tRyg==", - "dev": true - }, "stream-http": { "version": "2.8.3", "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz", diff --git a/package.json b/package.json index 1fb722a..376fc22 100644 --- a/package.json +++ b/package.json @@ -32,10 +32,10 @@ }, "homepage": "https://github.com/mzabriskie/moxios#readme", "peerDependencies": { - "axios": ">= 0.13.0" + "axios": ">= 0.25.0" }, "devDependencies": { - "axios": "^0.13.0", + "axios": "^0.25.0", "babel-cli": "^6.9.0", "babel-core": "^6.9.0", "babel-loader": "^6.2.4", From 62919387ee68b9d26faf48b9f6c83952e2695270 Mon Sep 17 00:00:00 2001 From: Nick Robinson Date: Fri, 21 Jan 2022 14:16:06 -0500 Subject: [PATCH 3/3] update test --- test.js | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/test.js b/test.js index 84910b7..c3493ee 100644 --- a/test.js +++ b/test.js @@ -86,15 +86,13 @@ describe('moxios', function () { moxios.withMock(function () { axios.get('/users/12345').then(onFulfilled) - moxios.wait(function () { - let request = moxios.requests.mostRecent() - request.respondWith({ - status: 200, - response: USER_FRED - }).then(function () { - equal(onFulfilled.called, true) - done() - }) + let request = moxios.requests.mostRecent() + request.respondWith({ + status: 200, + response: USER_FRED + }).then(function () { + equal(onFulfilled.called, true) + done() }) }) }) @@ -106,12 +104,10 @@ describe('moxios', function () { moxios.withMock(function() { axios.get('/users/12345') - moxios.wait(function() { - let request = moxios.requests.mostRecent() - request.respondWithTimeout().catch(function(err) { - equal(err.code, 'ECONNABORTED') - done() - }) + let request = moxios.requests.mostRecent() + request.respondWithTimeout().catch(function(err) { + equal(err.code, 'ECONNABORTED') + done() }) }) }) @@ -388,9 +384,7 @@ describe('moxios', function () { it('should stub requests with custom axios instance', function (done) { moxios.uninstall() - const instance = axios.create({ - baseURL: 'https://api.example.com' - }) + const instance = axios.create(); moxios.install(instance) @@ -399,10 +393,7 @@ describe('moxios', function () { response: USER_FRED }) - instance.get('/users/12346').then(onFulfilled) - - moxios.wait(function () { - let response = onFulfilled.getCall(0).args[0] + instance.get('/users/12346').then(function (response) { equal(response.status, 200) equal(response.data, USER_FRED) done()