Skip to content

Commit 9af432b

Browse files
committed
Simplify connect test file usage
1 parent 82b0bce commit 9af432b

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

test/components/connect.spec.tsx

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2181,7 +2181,7 @@ describe('React', () => {
21812181

21822182
const decorator = connect((state) => {
21832183
actualState = state
2184-
return {}
2184+
return { a: 42 }
21852185
})
21862186
const Decorated = decorator(Container)
21872187

@@ -2829,45 +2829,50 @@ describe('React', () => {
28292829
}
28302830

28312831
it('should throw a helpful error for invalid mapStateToProps arguments', () => {
2832-
//@ts-expect-error
2833-
@connect('invalid')
28342832
class InvalidMapState extends React.Component {
28352833
render() {
28362834
return <div />
28372835
}
28382836
}
28392837

2840-
const error = renderWithBadConnect(InvalidMapState)
2838+
//@ts-expect-error
2839+
// eslint-disable-next-line
2840+
const Connected = connect('invalid')(InvalidMapState)
2841+
2842+
const error = renderWithBadConnect(Connected)
28412843
expect(error).toContain('string')
28422844
expect(error).toContain('mapStateToProps')
28432845
expect(error).toContain('InvalidMapState')
28442846
})
28452847

28462848
it('should throw a helpful error for invalid mapDispatchToProps arguments', () => {
2847-
//@ts-expect-error
2848-
@connect(null, 'invalid')
28492849
class InvalidMapDispatch extends React.Component {
28502850
render() {
28512851
return <div />
28522852
}
28532853
}
28542854

2855-
const error = renderWithBadConnect(InvalidMapDispatch)
2855+
// eslint-disable-next-line
2856+
const Connected = connect(null, 'invalid')(InvalidMapDispatch)
2857+
2858+
const error = renderWithBadConnect(Connected)
28562859
expect(error).toContain('string')
28572860
expect(error).toContain('mapDispatchToProps')
28582861
expect(error).toContain('InvalidMapDispatch')
28592862
})
28602863

28612864
it('should throw a helpful error for invalid mergeProps arguments', () => {
2862-
// @ts-expect-error
2863-
@connect(null, null, 'invalid')
28642865
class InvalidMerge extends React.Component {
28652866
render() {
28662867
return <div />
28672868
}
28682869
}
28692870

2870-
const error = renderWithBadConnect(InvalidMerge)
2871+
// @ts-expect-error
2872+
// eslint-disable-next-line
2873+
const Connected = connect(null, null, 'invalid')(InvalidMerge)
2874+
2875+
const error = renderWithBadConnect(Connected)
28712876
expect(error).toContain('string')
28722877
expect(error).toContain('mergeProps')
28732878
expect(error).toContain('InvalidMerge')

0 commit comments

Comments
 (0)