Skip to content

Commit

Permalink
Fixes lint issues on test files
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrlplusb committed Jan 14, 2020
1 parent e8b5f92 commit 257be9d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/__tests__/component.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,18 @@ describe('<SizeMe />', () => {

it('should update the sizeme component when a new configuration is provided', () => {
const wrapper = shallow(<SizeMe {...sizeMeConfig}>{noop}</SizeMe>)
const newSizeMeConfig = Object.assign({}, sizeMeConfig, {
const newSizeMeConfig = {
...sizeMeConfig,
monitorHeight: false,
})
wrapper.setProps(
Object.assign({ children: noop }, sizeMeConfig, newSizeMeConfig),
)
}
wrapper.setProps({ ...sizeMeConfig, ...newSizeMeConfig })
expect(withSizeMock).toHaveBeenCalledTimes(2)
expect(withSizeMock).lastCalledWith(newSizeMeConfig)
})

it('should not update the sizeme component when a new configuration is provided', () => {
const wrapper = shallow(<SizeMe render={noop} {...sizeMeConfig} />)
wrapper.setProps(Object.assign({ render: () => 'NEW!' }, sizeMeConfig))
wrapper.setProps({ render: () => 'NEW!', ...sizeMeConfig })
expect(withSizeMock).toHaveBeenCalledTimes(1)
})
})
4 changes: 4 additions & 0 deletions src/__tests__/with-size.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/* eslint-disable no-underscore-dangle */
/* eslint-disable global-require */
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable react/jsx-one-expression-per-line */

import React from 'react'
import enzyme, { mount } from 'enzyme'
Expand Down Expand Up @@ -130,15 +131,18 @@ describe('withSize', () => {
// eslint-disable-next-line react/no-unused-state
size: null,
}

onSize = size =>
this.setState({
// eslint-disable-next-line react/no-unused-state
size,
})

render() {
return <SizeAwareComponent onSize={this.onSize} />
}
}

const mounted = mount(<SizeCallbackWrapper />)

// Get the callback for size changes.
Expand Down

0 comments on commit 257be9d

Please sign in to comment.