tohaveStyleRule not a function!!
Had this issue before, and solved this by downgrading style components. This is working on my other projects but not my new one, despite using the exact same package.json.
I'm really confused so any help i'd much appreciate.
"enzyme": "^3.8.0",
"enzyme-adapter-react-16": "^1.7.1",
"eslint-plugin-prettier": "^3.0.1",
"jest-styled-components": "^6.3.1",
"prettier": "^1.6.4",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react-scripts": "2.1.1",
"react-test-renderer": "^16.6.3",
"styled-components": "^3.3.2"
it('should default to the first slide', () => {
expect(element.find('SlideWrapper')).toHaveStyleRule(
'transform',
'translateX(0px)'
);
});
I do have this on a repo if you require. The only thing i could think of is that some caching is happening somewhere but i cleared my node modules and re installed.
Thanks in advance
I'm running into the same issue right now. Any help on this would be appreciated.
EDIT: Realized I forgot to import 'jest-styled-components'; at the top of my spec file.
In addition to having "jest-styled-components" I also needed "jest-enzyme"
I'm running into the same issue right now. Any help on this would be appreciated.
EDIT: Realized I forgot to
import 'jest-styled-components';at the top of my spec file.
Thank you bro! The same here. I just did the same and it worked.