generated from eea/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React from 'react'; | ||
import { MemoryRouter } from 'react-router-dom'; | ||
import configureStore from 'redux-mock-store'; | ||
import '@testing-library/jest-dom/extend-expect'; | ||
import { Provider } from 'react-intl-redux'; | ||
import NewsItemView from './NewsItemView'; | ||
import renderer from 'react-test-renderer'; | ||
import config from '@plone/volto/registry'; | ||
|
||
config.blocks = { | ||
blocksConfig: { | ||
title: { | ||
view: () => <div>Title Block Component</div>, | ||
}, | ||
}, | ||
}; | ||
|
||
const mockStore = configureStore(); | ||
|
||
jest.mock('semantic-ui-react', () => ({ | ||
...jest.requireActual('semantic-ui-react'), | ||
})); | ||
|
||
describe('NewsItemView', () => { | ||
it('should render the component', () => { | ||
const content = { | ||
title: 'NewsItemView', | ||
}; | ||
|
||
const store = mockStore({ | ||
userSession: { token: '1234' }, | ||
intl: { | ||
locale: 'en', | ||
messages: {}, | ||
}, | ||
}); | ||
|
||
const component = renderer.create( | ||
<Provider store={store}> | ||
<MemoryRouter> | ||
<NewsItemView content={content} /> | ||
</MemoryRouter> | ||
</Provider>, | ||
); | ||
const json = component.toJSON(); | ||
expect(json).toMatchSnapshot(); | ||
}); | ||
}); |
8 changes: 8 additions & 0 deletions
8
src/components/theme/Views/__snapshots__/NewsItemView.test.jsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AdaptationOptionView should render the component 1`] = ` | ||
<div | ||
className="insitu-newsitem-view" | ||
> | ||
</div> | ||
`; |