Skip to content

Commit

Permalink
Remove stubComponent for old Mascot
Browse files Browse the repository at this point in the history
Changes in #7893 has prevented the need to stub it out.

Change logout to lock in account-menu test
  • Loading branch information
tmashuang committed Jan 27, 2020
1 parent d714cb6 commit 2aec69c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 26 deletions.
22 changes: 0 additions & 22 deletions test/lib/render-helpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react'
import sinon from 'sinon'
import { mount } from 'enzyme'
import { MemoryRouter } from 'react-router-dom'
import PropTypes from 'prop-types'
Expand Down Expand Up @@ -49,24 +48,3 @@ export function mountWithRouter (component, store = {}, pathname = '/') {

return mount(<Wrapper />, createContext())
}

export function stubComponent (componentClass) {

const lifecycleMethods = [
'render',
'componentWillMount',
'componentDidMount',
'componentWillReceiveProps',
'shouldComponentUpdate',
'componentWillUpdate',
'componentDidUpdate',
'componentWillUnmount',
]

lifecycleMethods.forEach((method) => {
if (typeof componentClass.prototype[method] !== 'undefined') {
sinon.stub(componentClass.prototype, method).returns(null)
}
})

}
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ describe('Account Menu', async () => {

describe('Log Out', () => {
let logout

it('logout', () => {
logout = wrapper.find('.account-menu__logout-button')
logout = wrapper.find('.account-menu__lock-button')
assert.equal(logout.length, 1)
})

Expand Down
3 changes: 0 additions & 3 deletions ui/app/pages/unlock-page/tests/unlock-page.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import React from 'react'
import assert from 'assert'
import sinon from 'sinon'
import { mount } from 'enzyme'
import { stubComponent } from '../../../../../test/lib/render-helpers'
import UnlockPage from '../index'
import Mascot from '../../../components/ui/mascot'

describe('Unlock Page', () => {
let wrapper
Expand All @@ -21,7 +19,6 @@ describe('Unlock Page', () => {
showOptInModal: sinon.spy(),
}

stubComponent(Mascot)

beforeEach(() => {

Expand Down

0 comments on commit 2aec69c

Please sign in to comment.