import React from 'react';
import { mount } from 'enzyme';

import { Component } from '@core/utils/BEM';

describe('BEM Utils', () => {
  class TestComponent extends Component {
    constructor(props) {
      super(props, 'TestComponent');
    }

    render() {
      return <p className={this.bem.classes()}>Hello {this.name}</p>;
    }
  }

  it('BEM component should take an array as a parameter', () => {
    const node = mount(<TestComponent bem={[['test']]} />);
    expect(node.getDOMNode().classList).toContain('TestComponent_test');
  });

  it('BEM component should take a string as a parameter', () => {
    const node = mount(<TestComponent bem="test" />);
    expect(node.getDOMNode().classList).toContain('TestComponent-test');
  });
});
