@kiwicom/smart-faq
Version:
55 lines (45 loc) • 1.14 kB
JavaScript
// @flow
import * as React from 'react';
import { render } from 'enzyme';
import { ThemeProvider } from 'styled-components';
import { RawOneWayBookingHeader } from '../OneWay';
describe('OneWayBookingHeader', () => {
const mockRefType: any = null;
const booking = {
trip: {
departure: {
airport: {
city: {
name: 'Alpha Centauri',
},
},
},
arrival: {
airport: {
city: {
name: 'Kakrafoon',
},
},
},
},
$refType: mockRefType,
};
it('should display the city names in right order', () => {
const wrapper = render(<RawOneWayBookingHeader booking={booking} />);
expect(wrapper.text()).toEqual('Alpha CentauriKakrafoon');
});
it('should reverse the city names for rtl languages', () => {
const theme = {
orbit: {
fontFamily: 'Comic Sans',
},
rtl: true,
};
const result = render(
<ThemeProvider theme={theme}>
<RawOneWayBookingHeader booking={booking} />
</ThemeProvider>,
);
expect(result).toMatchSnapshot();
});
});