diff --git a/package.json b/package.json
index 27e9ed66e..5fd86913f 100644
--- a/package.json
+++ b/package.json
@@ -250,7 +250,7 @@
"node-sass": "^4.12.0",
"nyc": "^15.0.0",
"polyfill-crypto.getrandomvalues": "^1.0.0",
- "proxyquire": "2.0.1",
+ "proxyquire": "^2.1.3",
"qs": "^6.2.0",
"qunitjs": "^2.4.1",
"react-devtools": "^4.4.0",
@@ -266,7 +266,7 @@
"serve-handler": "^6.1.2",
"sesify": "^4.2.1",
"sesify-viz": "^3.0.5",
- "sinon": "^5.0.0",
+ "sinon": "^8.1.1",
"source-map": "^0.7.2",
"source-map-explorer": "^2.0.1",
"string.prototype.matchall": "^4.0.2",
diff --git a/ui/app/components/ui/button-group/tests/button-group-component.test.js b/ui/app/components/ui/button-group/tests/button-group-component.test.js
index 52c0a5021..5e304bc7c 100644
--- a/ui/app/components/ui/button-group/tests/button-group-component.test.js
+++ b/ui/app/components/ui/button-group/tests/button-group-component.test.js
@@ -4,21 +4,23 @@ import { shallow } from 'enzyme'
import sinon from 'sinon'
import ButtonGroup from '../button-group.component.js'
-const childButtonSpies = {
- onClick: sinon.spy(),
-}
+describe('ButtonGroup Component', function () {
+ let wrapper
-sinon.spy(ButtonGroup.prototype, 'handleButtonClick')
-sinon.spy(ButtonGroup.prototype, 'renderButtons')
+ const childButtonSpies = {
+ onClick: sinon.spy(),
+ }
-const mockButtons = [
- ,
- ,
- ,
-]
+ const mockButtons = [
+ ,
+ ,
+ ,
+ ]
-describe('ButtonGroup Component', function () {
- let wrapper
+ before(function () {
+ sinon.spy(ButtonGroup.prototype, 'handleButtonClick')
+ sinon.spy(ButtonGroup.prototype, 'renderButtons')
+ })
beforeEach(function () {
wrapper = shallow((
@@ -39,6 +41,10 @@ describe('ButtonGroup Component', function () {
ButtonGroup.prototype.renderButtons.resetHistory()
})
+ after(function () {
+ sinon.restore()
+ })
+
describe('componentDidUpdate', function () {
it('should set the activeButtonIndex to the updated newActiveButtonIndex', function () {
assert.equal(wrapper.state('activeButtonIndex'), 1)
diff --git a/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js b/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js
index 02b67621f..9ade59acf 100644
--- a/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js
+++ b/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js
@@ -4,19 +4,21 @@ import { shallow } from 'enzyme'
import sinon from 'sinon'
import AmountMaxButton from '../amount-max-button.component.js'
-const propsMethodSpies = {
- setAmountToMax: sinon.spy(),
- setMaxModeTo: sinon.spy(),
-}
-
-const MOCK_EVENT = { preventDefault: () => {} }
-
-sinon.spy(AmountMaxButton.prototype, 'setMaxAmount')
-
describe('AmountMaxButton Component', function () {
let wrapper
let instance
+ const propsMethodSpies = {
+ setAmountToMax: sinon.spy(),
+ setMaxModeTo: sinon.spy(),
+ }
+
+ const MOCK_EVENT = { preventDefault: () => {} }
+
+ before(function () {
+ sinon.spy(AmountMaxButton.prototype, 'setMaxAmount')
+ })
+
beforeEach(function () {
wrapper = shallow((
{} }
-
-sinon.spy(SendFooter.prototype, 'onCancel')
-sinon.spy(SendFooter.prototype, 'onSubmit')
-
describe('SendFooter Component', function () {
let wrapper
+ const propsMethodSpies = {
+ addToAddressBookIfNew: sinon.spy(),
+ clearSend: sinon.spy(),
+ sign: sinon.spy(),
+ update: sinon.spy(),
+ }
+ const historySpies = {
+ push: sinon.spy(),
+ }
+ const MOCK_EVENT = { preventDefault: () => {} }
+
+ before(function () {
+ sinon.spy(SendFooter.prototype, 'onCancel')
+ sinon.spy(SendFooter.prototype, 'onSubmit')
+ })
+
beforeEach(function () {
wrapper = shallow((
obj.balance !== obj.prevBalance),
-}
-
-const SendTransactionScreen = proxyquire('../send.component.js', {
- './send.utils': utilsMethodStubs,
-}).default
-
-sinon.spy(SendTransactionScreen.prototype, 'componentDidMount')
-sinon.spy(SendTransactionScreen.prototype, 'updateGas')
-
describe('Send Component', function () {
let wrapper
+ const mockBasicGasEstimates = {
+ blockTime: 'mockBlockTime',
+ }
+
+ const propsMethodSpies = {
+ updateAndSetGasLimit: sinon.spy(),
+ updateSendErrors: sinon.spy(),
+ updateSendTokenBalance: sinon.spy(),
+ resetSendState: sinon.spy(),
+ fetchBasicGasEstimates: sinon.stub().returns(Promise.resolve(mockBasicGasEstimates)),
+ fetchGasEstimates: sinon.spy(),
+ updateToNicknameIfNecessary: sinon.spy(),
+ }
+ const utilsMethodStubs = {
+ getAmountErrorObject: sinon.stub().returns({ amount: 'mockAmountError' }),
+ getGasFeeErrorObject: sinon.stub().returns({ gasFee: 'mockGasFeeError' }),
+ doesAmountErrorRequireUpdate: sinon.stub().callsFake(obj => obj.balance !== obj.prevBalance),
+ }
+
+ const SendTransactionScreen = proxyquire('../send.component.js', {
+ './send.utils': utilsMethodStubs,
+ }).default
+
+ before(function () {
+ sinon.spy(SendTransactionScreen.prototype, 'componentDidMount')
+ sinon.spy(SendTransactionScreen.prototype, 'updateGas')
+ })
+
beforeEach(function () {
wrapper = shallow((