awx/__tests__/components/About.test.jsx
kialam e77d81dd5b
Lift config context one level higher.
- Refactor About component to use config context.
- Update About component unit tests.
2019-01-03 15:20:41 -05:00

35 lines
961 B
JavaScript

import React from 'react';
import { mount } from 'enzyme';
import { I18nProvider } from '@lingui/react';
import api from '../../src/api';
import { API_CONFIG } from '../../src/endpoints';
import About from '../../src/components/About';
describe('<About />', () => {
let aboutWrapper;
let closeButton;
test('initially renders without crashing', () => {
aboutWrapper = mount(
<I18nProvider>
<About isOpen />
</I18nProvider>
);
expect(aboutWrapper.length).toBe(1);
aboutWrapper.unmount();
});
test('close button calls onAboutModalClose', () => {
const onAboutModalClose = jest.fn();
aboutWrapper = mount(
<I18nProvider>
<About isOpen onAboutModalClose={onAboutModalClose} />
</I18nProvider>
);
closeButton = aboutWrapper.find('AboutModalBoxCloseButton Button');
closeButton.simulate('click');
expect(onAboutModalClose).toBeCalled();
aboutWrapper.unmount();
});
});