Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. "jest": {
  2. "moduleNameMapper": {
  3. "\.(css|less)$": "identity-obj-proxy"
  4. },
  5. "transform": {
  6. "^.+\.tsx?$": "<rootDir>/node_modules/ts-jest/preprocessor.js",
  7. "\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/fileMock.js"
  8. },
  9. "testRegex": "\.(test|spec)\.tsx?$",
  10. "moduleFileExtensions": [
  11. "ts",
  12. "tsx",
  13. "js",
  14. "jsx",
  15. "json"
  16. ]
  17. }
  18.  
  19. import * as styles from './Foo.less';
  20. import myImg from './myImg.png';
  21.  
  22. export const Foo = () => (
  23. <div
  24. className="something"
  25. style={{backgroundImage: `url(${myImg})`}}
  26. >
  27. Some content
  28. </div>
  29. );
  30.  
  31. import * as React from 'react';
  32. import { shallow } from 'enzyme';
  33. import { Foo } from './Foo';
  34.  
  35. test('Foo has myImg in style prop', () => {
  36. const wrapper = shallow(
  37. <Foo />
  38. );
  39. expect(wrapper.find('.something').prop('style')).toContain('myImg.png');
  40. });
  41.  
  42. expect(object).toContain(value)
  43.  
  44. Expected object:
  45. {"backgroundImage": "url(undefined)"}
  46. To contain value:
  47. "myImg.png"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement