Revision 89b8fc37
Added by Amir Fefer over 4 years ago
webpack/assets/javascripts/react_app/components/common/forms/Form.test.js | ||
---|---|---|
import toJson from 'enzyme-to-json';
|
||
import { shallow } from 'enzyme';
|
||
import { shallow } from '@theforeman/test';
|
||
import React from 'react';
|
||
|
||
import Form from './Form';
|
||
... | ... | |
it('should render a form', () => {
|
||
const wrapper = shallow(<Form />);
|
||
|
||
expect(toJson(wrapper)).toMatchSnapshot();
|
||
expect(wrapper).toMatchSnapshot();
|
||
});
|
||
it('should display one base error', () => {
|
||
const wrapper = shallow(
|
||
<Form error={{ errorMsgs: ['invalid something'], severity: 'danger' }} />
|
||
);
|
||
|
||
expect(toJson(wrapper)).toMatchSnapshot();
|
||
expect(wrapper).toMatchSnapshot();
|
||
});
|
||
it('should display multiple base errors', () => {
|
||
const wrapper = shallow(
|
||
... | ... | |
/>
|
||
);
|
||
|
||
expect(toJson(wrapper)).toMatchSnapshot();
|
||
expect(wrapper).toMatchSnapshot();
|
||
});
|
||
it('should accept base error title', () => {
|
||
const wrapper = shallow(
|
||
... | ... | |
/>
|
||
);
|
||
|
||
expect(toJson(wrapper)).toMatchSnapshot();
|
||
expect(wrapper).toMatchSnapshot();
|
||
});
|
||
it('should dispaly form errors as warning', () => {
|
||
const wrapper = shallow(
|
||
... | ... | |
/>
|
||
);
|
||
|
||
expect(toJson(wrapper)).toMatchSnapshot();
|
||
expect(wrapper).toMatchSnapshot();
|
||
});
|
||
});
|
Also available in: Unified diff
Fixes #28488 - consume jest config from env