mirror of
https://github.com/strapi/strapi.git
synced 2025-08-31 20:33:03 +00:00
Merge pull request #10644 from strapi/fix/dnd-tests
Add DndProvider to fix the front tests
This commit is contained in:
commit
87d8847822
@ -4,6 +4,8 @@ import { createStore, combineReducers } from 'redux';
|
|||||||
import { Router } from 'react-router-dom';
|
import { Router } from 'react-router-dom';
|
||||||
import { createMemoryHistory } from 'history';
|
import { createMemoryHistory } from 'history';
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
|
import { DndProvider } from 'react-dnd';
|
||||||
|
import { HTML5Backend } from 'react-dnd-html5-backend';
|
||||||
import { render, screen } from '@testing-library/react';
|
import { render, screen } from '@testing-library/react';
|
||||||
import ContentManagerApp from '..';
|
import ContentManagerApp from '..';
|
||||||
import cmReducers from '../../../../reducers';
|
import cmReducers from '../../../../reducers';
|
||||||
@ -86,11 +88,13 @@ describe('Content manager | App | main', () => {
|
|||||||
history.push('/content-manager');
|
history.push('/content-manager');
|
||||||
|
|
||||||
const { container } = render(
|
const { container } = render(
|
||||||
<Provider store={store}>
|
<DndProvider backend={HTML5Backend}>
|
||||||
<Router history={history}>
|
<Provider store={store}>
|
||||||
<ContentManagerApp />
|
<Router history={history}>
|
||||||
</Router>
|
<ContentManagerApp />
|
||||||
</Provider>
|
</Router>
|
||||||
|
</Provider>
|
||||||
|
</DndProvider>
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(screen.getByText('Home page')).toBeVisible();
|
expect(screen.getByText('Home page')).toBeVisible();
|
||||||
@ -443,11 +447,13 @@ describe('Content manager | App | main', () => {
|
|||||||
history.push('/content-manager');
|
history.push('/content-manager');
|
||||||
|
|
||||||
render(
|
render(
|
||||||
<Provider store={store}>
|
<DndProvider backend={HTML5Backend}>
|
||||||
<Router history={history}>
|
<Provider store={store}>
|
||||||
<ContentManagerApp />
|
<Router history={history}>
|
||||||
</Router>
|
<ContentManagerApp />
|
||||||
</Provider>
|
</Router>
|
||||||
|
</Provider>
|
||||||
|
</DndProvider>
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(history.location.pathname).toEqual('/content-manager/homepage');
|
expect(history.location.pathname).toEqual('/content-manager/homepage');
|
||||||
@ -480,11 +486,13 @@ describe('Content manager | App | main', () => {
|
|||||||
history.push('/content-manager/collectionType/category');
|
history.push('/content-manager/collectionType/category');
|
||||||
|
|
||||||
render(
|
render(
|
||||||
<Provider store={store}>
|
<DndProvider backend={HTML5Backend}>
|
||||||
<Router history={history}>
|
<Provider store={store}>
|
||||||
<ContentManagerApp />
|
<Router history={history}>
|
||||||
</Router>
|
<ContentManagerApp />
|
||||||
</Provider>
|
</Router>
|
||||||
|
</Provider>
|
||||||
|
</DndProvider>
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(history.location.pathname).toEqual('/content-manager/403');
|
expect(history.location.pathname).toEqual('/content-manager/403');
|
||||||
@ -510,11 +518,13 @@ describe('Content manager | App | main', () => {
|
|||||||
history.push('/content-manager/collectionType/category');
|
history.push('/content-manager/collectionType/category');
|
||||||
|
|
||||||
render(
|
render(
|
||||||
<Provider store={store}>
|
<DndProvider backend={HTML5Backend}>
|
||||||
<Router history={history}>
|
<Provider store={store}>
|
||||||
<ContentManagerApp />
|
<Router history={history}>
|
||||||
</Router>
|
<ContentManagerApp />
|
||||||
</Provider>
|
</Router>
|
||||||
|
</Provider>
|
||||||
|
</DndProvider>
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(history.location.pathname).toEqual('/content-manager/no-content-types');
|
expect(history.location.pathname).toEqual('/content-manager/no-content-types');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user