Guest User

Untitled

a guest
Dec 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. at createStoreInjector (node_modules/mobx-react/index.js:585:46)
  2. at node_modules/mobx-react/index.js:698:16
  3. at Object.<anonymous> (src/Home/Home.tsx:21:76)
  4. at Object.<anonymous> (src/Home/Home.test.tsx:17:189)
  5.  
  6. import withStyles, { WithStyles } from '@material-ui/core/styles/withStyles';
  7. import classNames from 'classnames';
  8. import { inject, observer } from 'mobx-react';
  9. import * as React from 'react';
  10. import { RouteComponentProps, withRouter } from 'react-router-dom';
  11. import logo from '../logo.svg';
  12. import { HomeStore } from '../Stores/HomeStore';
  13. import { styles } from './Home.Styles';
  14.  
  15. interface IProps extends RouteComponentProps<{}> {
  16. homeStore?: HomeStore;
  17. }
  18.  
  19. export default withStyles(styles)(
  20. inject('homeStore')(
  21. withRouter(
  22. observer(
  23. class Home extends React.Component<
  24. IProps & RouteComponentProps<{}> & WithStyles<typeof styles>,
  25. {}
  26. > {
  27. public render() {
  28. const { classes } = this.props;
  29. return (
  30. <div className={classes.app}>
  31. <header className={classes.appHeader}>
  32. <img src={logo} className={classNames(classes.appLogo, classes.spin)} alt='logo' />
  33. <h1 className={classes.appTitle}>Welcome to React</h1>
  34. </header>
  35. <p className={classes.appIntro}>
  36. To get started, edit <code>src/App.tsx</code> and save to reload.
  37. </p>
  38. </div>
  39. );
  40. }
  41. }))));
  42.  
  43. import { shallow, ShallowWrapper } from 'enzyme';
  44. import * as React from 'react';
  45. import { MemoryRouter } from 'react-router';
  46. import { HomeStore } from '../Stores/HomeStore';
  47. import Home from './Home';
  48.  
  49. jest.mock('react-router-dom');
  50. jest.mock('./Home.styles');
  51.  
  52. const homeStore = {} as HomeStore;
  53.  
  54. const props = {
  55. homeStore: homeStore,
  56. history: {},
  57. location: {},
  58. match: {},
  59. staticContext: {}
  60. };
  61.  
  62. describe('Order Tests', () => {
  63. let homeWrapper: ShallowWrapper;
  64.  
  65. beforeEach(() => {
  66. homeWrapper = shallow(<MemoryRouter><Home {...props} /></MemoryRouter>).first().shallow().first().shallow();
  67. console.log(homeWrapper.debug());
  68. });
  69.  
  70. it('passes a test', () => {
  71. expect(true).toBe(true);
  72. });
  73. });
Add Comment
Please, Sign In to add comment