rohan-paul / chainable-dropdown-list

Small MERN app where one dropdown lists should get updated based on selections made on other dropdown list
4 stars 0 forks source link

Failing Karma test - Error "Element type is invalid: expected a string..." #2

Open rohan-paul opened 6 years ago

rohan-paul commented 6 years ago

The below 2 tests are failing - giving " Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined."

describe('FilterOptions', function () {
  it('loads without problems', function () {
    var FilterOptions = ReactTestUtils.renderIntoDocument(<FilterOptions/>);

  expect(FilterOptions).toExist();
  });
});
describe('FilterOptions', function () {

  it('changes without problems', function () {
    var FilterOptions =  ReactTestUtils.renderIntoDocument(<FilterOptions/>);

    const inputNode = ReactDOM.findDOMNode(FilterOptions.refs.input);

    const newValue = 'some text';
    inputNode.value = newValue;
    ReactTestUtils.Simulate.change(inputNode);

    const nameNode = ReactDOM.findDOMNode(FilterOptions.refs.name);
    expect(nameNode.textContent).toEqual(newValue);
  });
});