Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- at createStoreInjector (node_modules/mobx-react/index.js:585:46)
- at node_modules/mobx-react/index.js:698:16
- at Object.<anonymous> (src/Home/Home.tsx:21:76)
- at Object.<anonymous> (src/Home/Home.test.tsx:17:189)
- import withStyles, { WithStyles } from '@material-ui/core/styles/withStyles';
- import classNames from 'classnames';
- import { inject, observer } from 'mobx-react';
- import * as React from 'react';
- import { RouteComponentProps, withRouter } from 'react-router-dom';
- import logo from '../logo.svg';
- import { HomeStore } from '../Stores/HomeStore';
- import { styles } from './Home.Styles';
- interface IProps extends RouteComponentProps<{}> {
- homeStore?: HomeStore;
- }
- export default withStyles(styles)(
- inject('homeStore')(
- withRouter(
- observer(
- class Home extends React.Component<
- IProps & RouteComponentProps<{}> & WithStyles<typeof styles>,
- {}
- > {
- public render() {
- const { classes } = this.props;
- return (
- <div className={classes.app}>
- <header className={classes.appHeader}>
- <img src={logo} className={classNames(classes.appLogo, classes.spin)} alt='logo' />
- <h1 className={classes.appTitle}>Welcome to React</h1>
- </header>
- <p className={classes.appIntro}>
- To get started, edit <code>src/App.tsx</code> and save to reload.
- </p>
- </div>
- );
- }
- }))));
- import { shallow, ShallowWrapper } from 'enzyme';
- import * as React from 'react';
- import { MemoryRouter } from 'react-router';
- import { HomeStore } from '../Stores/HomeStore';
- import Home from './Home';
- jest.mock('react-router-dom');
- jest.mock('./Home.styles');
- const homeStore = {} as HomeStore;
- const props = {
- homeStore: homeStore,
- history: {},
- location: {},
- match: {},
- staticContext: {}
- };
- describe('Order Tests', () => {
- let homeWrapper: ShallowWrapper;
- beforeEach(() => {
- homeWrapper = shallow(<MemoryRouter><Home {...props} /></MemoryRouter>).first().shallow().first().shallow();
- console.log(homeWrapper.debug());
- });
- it('passes a test', () => {
- expect(true).toBe(true);
- });
- });
Add Comment
Please, Sign In to add comment