Created
August 12, 2016 17:22
-
-
Save rodrigopr/7c0dfe9adc6e2f36fed3c5c2a6b6daee to your computer and use it in GitHub Desktop.
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
import { shallow } from 'enzyme'; | |
const deepShallow = (endCondition) => (element) => { | |
let wrapper = shallow(element); | |
while (wrapper.node && !endCondition(wrapper)) { | |
wrapper = wrapper.shallow(); | |
} | |
return wrapper; | |
} | |
export const deepShallowTo = (ExpectedComp) => deepShallow( | |
(wrapper) => wrapper.type() === ExpectedComp | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment