@kiwicom/smart-faq
Version:
65 lines (53 loc) • 1.33 kB
JavaScript
// @flow
import * as React from 'react';
import { render } from 'enzyme';
import { ThemeProvider } from 'styled-components';
import bookingTypes from '../../../common/booking/bookingTypes';
import { FromToRow } from '../FromToRow';
const mockRefType: any = null;
const arrival = {
airport: {
city: {
name: 'Barcelona',
},
locationId: 'BCN',
},
$refType: mockRefType,
};
const departure = {
airport: {
city: { name: 'Prague' },
locationId: 'PRG',
},
$refType: mockRefType,
};
const theme = {
orbit: {
paletteInkLighter: '#bac7d5',
},
};
describe('FromToRow', () => {
const component = render(
<ThemeProvider theme={theme}>
<FromToRow
type={bookingTypes.MULTICITY}
arrival={arrival}
departure={departure}
/>
</ThemeProvider>,
);
it('should render correctly', () => {
expect(component).toMatchSnapshot();
});
it('should render flight direction icon', () => {
expect(component.find('.flightDirectionIcon')).toBeTruthy();
});
it('should show IATA codes', () => {
expect(component.text()).toContain('PRG');
expect(component.text()).toContain('BCN');
});
it('should show city names', () => {
expect(component.text()).toContain('Prague');
expect(component.text()).toContain('Barcelona');
});
});