import React from 'react';
import TestUtils from 'react/lib/ReactTestUtils';
import { Menu } from './menu';

describe('Menu', () => {
  let instance;

  beforeEach(() => {
    instance = TestUtils.renderIntoDocument(
      <Menu className="foobar">
        foo
      </Menu>
    );
  });

  it('renders with correct classes', () => {
    let div = TestUtils.findRenderedDOMComponentWithTag(instance, 'div');
    expect(div.className).toEqual('carbon-menu foobar carbon-menu--primary');
  });

  it('renders with secondary class', () => {
    instance = TestUtils.renderIntoDocument(
      <Menu className="foobar" as="secondary">
        foo
      </Menu>
    );
    let div = TestUtils.findRenderedDOMComponentWithTag(instance, 'div');
    expect(div.className).toEqual('carbon-menu foobar carbon-menu--secondary');
  });
});

import React from 'react';
import { Menu } from './menu';
import { shallow } from 'enzyme';

describe('Menu', () => {
  let wrapper;

  beforeEach(() => {
    wrapper = shallow(
      <Menu className="foobar">
        foo
      </Menu>
    );
  });

  it('renders with correct classes', () => {
    expect(wrapper.hasClass('carbon-menu foobar carbon-menu--primary')).toEqual(true);
  });

  it('renders with secondary class', () => {
    wrapper = shallow(
      <Menu className="foobar" as="secondary">
        foo
      </Menu>
    );
    expect(wrapper.hasClass('carbon-menu foobar carbon-menu--secondary')).toEqual(true);
  });

});

Refactor tests to use enzyme
Refactor tests to use enzyme

Tests use enzyme instead of TestUtils.
