mardi 1 mars 2016

Error while testing React component using Jasmine

I kept getting this error while testing a react component:

Error: Invariant Violation: findComponentRoot(..., .0): Unable to find element. This probably means the DOM was unexpectedly mutated (e.g., by the browser), usually due to forgetting a when using tables, nesting tags like ,

, or , or using non-SVG elements in an parent. Try inspecting the child nodes of the element with React ID ``.

Code I used to test:

describe(`Method: flattenData`, () => {

  const tests = [
    {
      toFlatten: {
        'key1': 'k',
        'key2': 'n',
        'key3': 'o'
      },
      expectedResult: 'key1: k; key2: n; key3: o'
    }
  ];

  tests.forEach((test) => {

    expect(instance.flattenData(test.toFlatten)).toEqual(test.expectedResult);

   });

});

Aucun commentaire:

Enregistrer un commentaire