Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "jest": {
- "moduleNameMapper": {
- "\.(css|less)$": "identity-obj-proxy"
- },
- "transform": {
- "^.+\.tsx?$": "<rootDir>/node_modules/ts-jest/preprocessor.js",
- "\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/fileMock.js"
- },
- "testRegex": "\.(test|spec)\.tsx?$",
- "moduleFileExtensions": [
- "ts",
- "tsx",
- "js",
- "jsx",
- "json"
- ]
- }
- import * as styles from './Foo.less';
- import myImg from './myImg.png';
- export const Foo = () => (
- <div
- className="something"
- style={{backgroundImage: `url(${myImg})`}}
- >
- Some content
- </div>
- );
- import * as React from 'react';
- import { shallow } from 'enzyme';
- import { Foo } from './Foo';
- test('Foo has myImg in style prop', () => {
- const wrapper = shallow(
- <Foo />
- );
- expect(wrapper.find('.something').prop('style')).toContain('myImg.png');
- });
- expect(object).toContain(value)
- Expected object:
- {"backgroundImage": "url(undefined)"}
- To contain value:
- "myImg.png"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement