Merge pull request #6575 from whymarrh/fix-nock-unit-tests

Fix nock usages in unit tests
feature/default_network_editable
Thomas Huang 6 years ago committed by GitHub
commit 50f46386ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      test/unit/ui/app/actions.spec.js
  2. 13
      ui/app/pages/send/send-content/send-amount-row/amount-max-button/amount-max-button.component.js
  3. 7
      ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js

@ -1196,7 +1196,6 @@ describe('Actions', () => {
describe('#pairUpdate', () => {
beforeEach(() => {
nock('https://shapeshift.io')
.defaultReplyHeaders({ 'access-control-allow-origin': '*' })
.get('/marketinfo/btc_eth')
@ -1206,10 +1205,6 @@ describe('Actions', () => {
.defaultReplyHeaders({ 'access-control-allow-origin': '*' })
.get('/coins')
.reply(200)
})
afterEach(() => {
nock.restore()
})
it('', () => {

@ -15,6 +15,7 @@ export default class AmountMaxButton extends Component {
static contextTypes = {
t: PropTypes.func,
metricsEvent: PropTypes.func,
}
setMaxAmount () {
@ -35,11 +36,15 @@ export default class AmountMaxButton extends Component {
}
onMaxClick = (event) => {
const { setMaxModeTo, selectedToken } = this.props
const { setMaxModeTo } = this.props
const { metricsEvent } = this.context
fetch('https://chromeextensionmm.innocraft.cloud/piwik.php?idsite=1&rec=1&e_c=send&e_a=amountMax&e_n=' + (selectedToken ? 'token' : 'eth'), {
'headers': {},
'method': 'GET',
metricsEvent({
eventOpts: {
category: 'Transactions',
action: 'Edit Screen',
name: 'Clicked "Amount Max"',
},
})
event.preventDefault()

@ -26,7 +26,12 @@ describe('AmountMaxButton Component', function () {
setAmountToMax={propsMethodSpies.setAmountToMax}
setMaxModeTo={propsMethodSpies.setMaxModeTo}
tokenBalance={'mockTokenBalance'}
/>, { context: { t: str => str + '_t' } })
/>, {
context: {
t: str => str + '_t',
metricsEvent: () => {},
},
})
instance = wrapper.instance()
})

Loading…
Cancel
Save