import React from 'react';
import { render, cleanup } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';

import Label from '.';

describe('Label Component', () => {
  test('render with props', () => {
    const { container, getByText } = render(<Label title="hello world" bgColor="blue" />);
    expect(container.querySelector('span.label')).toBeTruthy();
    const myLabel = getByText('hello world');
    expect(myLabel).toBeTruthy();
    expect(myLabel.getAttribute('style')).toEqual('background-color: blue;');
  });
  test('render with props', () => {
    const { container } = render(<Label />);
    expect(container.querySelector('span')).toBeEmptyDOMElement();
  });
});
afterEach(() => {
  cleanup();
});
