File size: 1,574 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
/**
*
* Tests for {{ properCase name }}
*
* @see https://github.com/react-boilerplate/react-boilerplate/tree/master/docs/testing
*
*/
import React from 'react';
import { render } from 'react-testing-library';
{{#if wantMessages}}
import { IntlProvider } from 'react-intl';
{{/if}}
// import 'jest-dom/extend-expect'; // add some helpful assertions
import { {{ properCase name }} } from '../index';
{{#if wantMessages}}
import { DEFAULT_LOCALE } from '../../../i18n';
{{/if}}
describe('<{{ properCase name }} />', () => {
it('Expect to not log errors in console', () => {
const spy = jest.spyOn(global.console, 'error');
const dispatch = jest.fn();
{{#if wantMessages}}
render(
<IntlProvider locale={DEFAULT_LOCALE}>
<{{ properCase name }} dispatch={dispatch} />
</IntlProvider>,
);
{{else}}
render(<{{ properCase name }} dispatch={dispatch} />);
{{/if}}
expect(spy).not.toHaveBeenCalled();
});
it('Expect to have additional unit tests specified', () => {
expect(true).toEqual(false);
});
/**
* Unskip this test to use it
*
* @see {@link https://jestjs.io/docs/en/api#testskipname-fn}
*/
it.skip('Should render and match the snapshot', () => {
{{#if wantMessages}}
const {
container: { firstChild },
} = render(
<IntlProvider locale={DEFAULT_LOCALE}>
<{{ properCase name }} />
</IntlProvider>,
);
{{else}}
const {
container: { firstChild },
} = render(<{{ properCase name }} />);
{{/if}}
expect(firstChild).toMatchSnapshot();
});
});
|