title: Error " Invariant violation : Element type is invalid: expected a string
body: <p>I am new to Unit testing. I am trying to run a test but I keep getting the following error : </p>
  
  <p>React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in.
  I ran with { import Headers } and without {} and I keep getting the same error.</p>
  
  <p>This is the current test. </p>
  
  <pre><code> import React from 'react';
  import { Headers } from './Headers';
  import { configure} from 'enzyme';
  import Adapter from 'enzyme-adapter-react-15';
  import  * as renderer from 'react-test-renderer';
  
  configure({adapter: new Adapter()});
  
  describe('Headers', () =&gt; {
  
  let tree;
  let baseProps;
  let mockauthKeyValues;
  let mockheaderKeyValues = {
      type: "TEST1",
      defaultData : "test",
  };
  let mockaddNewKeyValue;
  
   beforeEach(() =&gt; {
      baseProps = { // assing all of the props into MOCK
          authKeyValues: mockauthKeyValues,
         headerKeyValues: mockheaderKeyValues,
         addNewKeyValue: mockaddNewKeyValue
      }
  })
  
   it ('should render without a authkeyvalues',() =&gt; {
  baseProps = {
      ...baseProps,
      authKeyValues: {},
      };
      tree = renderer.create(&lt;Headers {...baseProps } /&gt;)
      let treeJson = tree.toJSON();
      expect(treeJson).toMatchSnapshot();
      tree.unmount()
  });
  
   it ('should render without headerKeyValues',() =&gt; {
  baseProps = {
      ...baseProps,
      headerKeyValues: {},
  };
      tree = renderer.create(&lt;Headers {...baseProps } /&gt;)
      let treeJson = tree.toJSON();
      expect(treeJson).toMatchSnapshot();
      tree.unmount()
  });
  
  it ('should render without addNewKeyValue',() =&gt; {
  baseProps = {
      ...baseProps,
      addNewKeyValue: {},
  };
      tree = renderer.create(&lt;Headers {...baseProps } /&gt;)
      let treeJson = tree.toJSON();
      expect(treeJson).toMatchSnapshot();
      tree.unmount()
  });
  
  
   it('should render with all of the props', () =&gt; {  
      tree = renderer.create(&lt;Headers {...baseProps} /&gt;)
      let treeJson = tree.toJSON()
      expect(treeJson).toMatchSnapshot();
      tree.unmount()
  });
  </code></pre>
  
  <p>});</p>
  
  <p>Headers.js</p>
  
  <pre><code>import React, { PropTypes, Component } from 'react'
  import KeyValue from '../Utils/KeyValuePair'
  const shortid = require('shortid')
  
  export class Headers extends Component {
  
  componentDidMount () {
  if (this.props.authKeyValues == null) {
    this.setState({
      useDefaultData: false
    })
  } else {
    this.setState({
      useDefaultData: true
    })
  }
  }
  
  generateKeyValues = () =&gt; {
   if (this.props.headerKeyValues == null) {
    return (
      &lt;KeyValue
        id={shortid.generate()}
        type='headers'
        addNewKeyValue={this.props.addNewKeyValue}
      /&gt;
    )
  } else {
   let defaultKeyValues = Object.keys(this.props.headerKeyValues).map((headerKey, idx) =&gt; {
      return (
        &lt;KeyValue
          key={headerKey}
          id={headerKey}
          type={this.props.headerKeyValues[headerKey].type}
          addNewKeyValue={this.props.addNewKeyValue}
          defaultData={this.props.headerKeyValues[headerKey]}
        /&gt;
      )
    })
    defaultKeyValues.push(
      &lt;KeyValue
        id={shortid.generate()}
        type='headers'
        addNewKeyValue={this.props.addNewKeyValue}
      /&gt;
    )
    return defaultKeyValues
  }
  }
  
  render () {
    return (
      &lt;div&gt;
        {this.generateKeyValues()}
      &lt;/div&gt;
      )
   }
  }
  </code></pre>
  
  <p>I expected the test to pass by getting all the props called correct.</p>