client/src/__tests__/App.test.js
author ymh <ymh.work@gmail.com>
Mon, 08 Oct 2018 18:35:47 +0200
changeset 168 ea92f4fe783d
parent 8 6f572b6b6be3
permissions -rw-r--r--
- move SlateEditor and dependencies to its own folder - remove Immutable - remove redux-persist-immutable - remobe redux-immutable - update libraries - added tests on store manipulations (accessor and reducers)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3
3b5d37d84cfe Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
import React from 'react';
3b5d37d84cfe Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
import ReactDOM from 'react-dom';
168
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 8
diff changeset
     3
import { Provider } from 'react-redux';
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 8
diff changeset
     4
import { MemoryRouter } from 'react-router';
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 8
diff changeset
     5
import { createMemoryHistory } from 'history'
3
3b5d37d84cfe Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
3b5d37d84cfe Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
import App from '../App';
3b5d37d84cfe Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
import configureStore from '../store/configureStore';
3b5d37d84cfe Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
8
6f572b6b6be3 try to make tests work again
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
    10
beforeAll(() => {
6f572b6b6be3 try to make tests work again
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
    11
  window.getSelection = () => {
6f572b6b6be3 try to make tests work again
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
    12
    return {
6f572b6b6be3 try to make tests work again
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
    13
      removeAllRanges: () => {}
6f572b6b6be3 try to make tests work again
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
    14
    };
6f572b6b6be3 try to make tests work again
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
    15
  };
6f572b6b6be3 try to make tests work again
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
    16
});
6f572b6b6be3 try to make tests work again
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
    17
168
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 8
diff changeset
    18
const history = createMemoryHistory();
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 8
diff changeset
    19
const { store } = configureStore(history);
3
3b5d37d84cfe Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
3b5d37d84cfe Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
it('renders without crashing', () => {
3b5d37d84cfe Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
  const div = document.createElement('div');
3b5d37d84cfe Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
  ReactDOM.render(
3b5d37d84cfe Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
    <Provider store={store}>
168
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 8
diff changeset
    25
      <MemoryRouter>
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 8
diff changeset
    26
        <App />
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 8
diff changeset
    27
      </MemoryRouter>
3
3b5d37d84cfe Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
    </Provider>,
3b5d37d84cfe Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
    div);
3b5d37d84cfe Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
});