Skip to content

Commit

Permalink
Refs #267520 - Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
GhitaB committed Mar 25, 2024
1 parent 38e3550 commit ffa8a1f
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/components/theme/Views/NewsItemView.test.jsx
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();
});
});
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>
`;

0 comments on commit ffa8a1f

Please sign in to comment.