Created
November 13, 2019 09:08
-
-
Save SPavelV/068fd83a3c01d764f97c703066e0c834 to your computer and use it in GitHub Desktop.
Enzyme instance() method should be able to carry type of wrapped class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MyComponentWithMethods extends React.Component<{}, {}> { | |
| someMethod() { | |
| return 'some string'; | |
| } | |
| } | |
| test('instance type by providing component type explicitly works', () => { | |
| const wrapper = shallow<MyComponentWithMethods>(<MyComponentWithMethods />); | |
| expect(wrapper.instance().someMethod()).toBe('some string'); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment