mercredi 25 juillet 2018

React test decorated component

I have a component which I want to test, and which is decorated by react-redux, something like that:

@connect()
export default class MyComponent extends React {
    render () {
       return <div>MyComponent</div>
    }
}

I want to change it to be available for tests without any decorators, so I can write:

export class MyComponent extends React {
    render () {
       return <div>MyComponent</div>
    }
}

export default connect()(MyComponent)

But I want to use decorator here (@connect), beacuse I will have some more HOC. How can I accomplish this?

Aucun commentaire:

Enregistrer un commentaire