diff options
author | Thomas Huang <tmashuang@users.noreply.github.com> | 2019-05-08 00:41:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-08 00:41:05 +0800 |
commit | 50f46386ae122eb364681ff6c3c888cfee5ebd3f (patch) | |
tree | a53eccac7cb106c46104dc9460d6711015c1b975 | |
parent | 581128503c161bc3b569ca5d87e4eea8b0d15150 (diff) | |
parent | 1de7dc9b41e8064f8e37dbfcb20736d06b84ae96 (diff) | |
download | tangerine-wallet-browser-50f46386ae122eb364681ff6c3c888cfee5ebd3f.tar tangerine-wallet-browser-50f46386ae122eb364681ff6c3c888cfee5ebd3f.tar.gz tangerine-wallet-browser-50f46386ae122eb364681ff6c3c888cfee5ebd3f.tar.bz2 tangerine-wallet-browser-50f46386ae122eb364681ff6c3c888cfee5ebd3f.tar.lz tangerine-wallet-browser-50f46386ae122eb364681ff6c3c888cfee5ebd3f.tar.xz tangerine-wallet-browser-50f46386ae122eb364681ff6c3c888cfee5ebd3f.tar.zst tangerine-wallet-browser-50f46386ae122eb364681ff6c3c888cfee5ebd3f.zip |
Merge pull request #6575 from whymarrh/fix-nock-unit-tests
Fix nock usages in unit tests
3 files changed, 15 insertions, 10 deletions
diff --git a/test/unit/ui/app/actions.spec.js b/test/unit/ui/app/actions.spec.js index 86c3f8aff..edbcb4a8b 100644 --- a/test/unit/ui/app/actions.spec.js +++ b/test/unit/ui/app/actions.spec.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('', () => { diff --git a/ui/app/pages/send/send-content/send-amount-row/amount-max-button/amount-max-button.component.js b/ui/app/pages/send/send-content/send-amount-row/amount-max-button/amount-max-button.component.js index f17137c1e..e256d1442 100644 --- a/ui/app/pages/send/send-content/send-amount-row/amount-max-button/amount-max-button.component.js +++ b/ui/app/pages/send/send-content/send-amount-row/amount-max-button/amount-max-button.component.js @@ -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() 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 b04d3897f..a6cb29d4c 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 @@ -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() }) |