// @flow
import React from 'react';
import { mountWrappedComponent, itIsAccessible } from '../../../utils/tests';

import type { SideBarProps } from './side-bar.proptypes';
import { SideBar } from './index';

const DEFAULT_PROPS: SideBarProps = {
  title: 'Best side bar ever',
  text: ['A long piece of text.', 'Another long piece of text'],
};

describe('SideBar', () => {
  it('renders a title', () => {
    const sideBar = mountWrappedComponent(<SideBar {...DEFAULT_PROPS} />);
    expect(sideBar.contains(DEFAULT_PROPS.title)).toBe(true);
  });

  it('renders text', () => {
    const sideBar = mountWrappedComponent(<SideBar {...DEFAULT_PROPS} />);
    DEFAULT_PROPS.text.forEach((string) => {
      expect(sideBar.contains(string)).toBe(true);
    });
  });

  itIsAccessible(<SideBar {...DEFAULT_PROPS} />);
});
