client/src/__tests__/App.test.js
author ymh <ymh.work@gmail.com>
Fri, 30 Nov 2018 10:53:15 +0100
changeset 183 f8f3af9e5c83
parent 168 ea92f4fe783d
permissions -rw-r--r--
Change the settings to avoid using Session authentication for rest framework as it raise exceptions in case client and backend are on the same domain On the filter, adapt to take into account new version of django_filters
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
});